|
@@ -11,7 +11,28 @@ export class AiChatService {
|
|
|
emojis: Array<any> = [];
|
|
|
|
|
|
constructor(private router: Router, private http: HttpService) {
|
|
|
- this.initEmoji()
|
|
|
+ this.initEmoji();
|
|
|
+ }
|
|
|
+ async getAccountLog(): Promise<any> {
|
|
|
+ const uid = Parse.User.current()?.id;
|
|
|
+ let query = new Parse.Query('Account');
|
|
|
+ query.equalTo('user', uid);
|
|
|
+ query.notEqualTo('isDeleted', true);
|
|
|
+ query.select('objectId');
|
|
|
+ let account = await query.first();
|
|
|
+ if (!account?.id) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ let sql = `SELECT alog."assetCount",TO_CHAR(alog."createdAt", 'YYYY-MM-DD HH24:MI:SS') AS time,
|
|
|
+ (CASE WHEN alog."targetAccount" = '${account.id}' THEN 'recharge' ELSE 'used' END) cate,
|
|
|
+ "assetType","orderNumber","desc"
|
|
|
+ FROM "AccountLog" AS alog
|
|
|
+ WHERE (alog."targetAccount" = '${account.id}' OR alog."fromAccount" = '${account.id}')
|
|
|
+ AND alog."isVerified" IS TRUE
|
|
|
+ AND alog."isDeleted" IS NOT TRUE
|
|
|
+ ORDER BY alog."createdAt"`;
|
|
|
+ let data: any = await this.http.customSQL(sql);
|
|
|
+ return data?.data;
|
|
|
}
|
|
|
initEmoji() {
|
|
|
let emojiChar =
|
|
@@ -193,11 +214,7 @@ export class AiChatService {
|
|
|
}
|
|
|
|
|
|
/* 赠送礼物 */
|
|
|
- async putGift(
|
|
|
- toUid: string,
|
|
|
- gid: string,
|
|
|
- giftCount?: number
|
|
|
- ): Promise<any> {
|
|
|
+ async putGift(toUid: string, gid: string, giftCount?: number): Promise<any> {
|
|
|
let baseurl = 'https://server.fmode.cn/api/ailiao/save_gift';
|
|
|
let reqBody = {
|
|
|
fromUid: Parse.User.current()?.id,
|
|
@@ -216,24 +233,24 @@ export class AiChatService {
|
|
|
params['company'] = this.company;
|
|
|
let baseurl = 'https://server.fmode.cn/api/ailiao/roomlist';
|
|
|
const data = await this.http.httpRequst(baseurl, params, 'POST');
|
|
|
- return data?.data
|
|
|
+ return data?.data;
|
|
|
}
|
|
|
|
|
|
- async getOrderAnchor(limit?:number){
|
|
|
+ async getOrderAnchor(limit?: number) {
|
|
|
let sql = `SELECT us."objectId",us."nickname",us."avatar",
|
|
|
COALESCE(SUM(llog.gold ),0) AS "credit"
|
|
|
FROM "LoveRender" AS llog
|
|
|
LEFT JOIN "_User" us
|
|
|
ON us."objectId" = llog."toUser"
|
|
|
- WHERE llog.company = 'Qje9D4bqol'
|
|
|
+ WHERE llog.company = '${this.company}'
|
|
|
AND llog."isDeleted" IS NOT TRUE
|
|
|
GROUP BY us."objectId",us."username"
|
|
|
- ORDER BY "credit" DESC LIMIT ${limit ?? 10}`
|
|
|
- let res:any = await this.http.customSQL(sql);
|
|
|
- return res.data
|
|
|
+ ORDER BY "credit" DESC LIMIT ${limit ?? 10}`;
|
|
|
+ let res: any = await this.http.customSQL(sql);
|
|
|
+ return res.data;
|
|
|
}
|
|
|
|
|
|
- async get_duration(rid:string,uid:string) {
|
|
|
+ async get_duration(rid: string, uid: string) {
|
|
|
let url = 'https://server.fmode.cn/api/ailiao/remain_second';
|
|
|
let params = {
|
|
|
rid: rid,
|
|
@@ -243,4 +260,45 @@ export class AiChatService {
|
|
|
console.log(data);
|
|
|
return data.data ?? 0;
|
|
|
}
|
|
|
+
|
|
|
+ //星座
|
|
|
+ getConstellation(idCard: string): string {
|
|
|
+ // 提取出生日期部分
|
|
|
+ const birthDateStr = idCard.substring(6, 14);
|
|
|
+ const year = parseInt(birthDateStr.substring(0, 4), 10);
|
|
|
+ const month = parseInt(birthDateStr.substring(4, 6), 10);
|
|
|
+ const day = parseInt(birthDateStr.substring(6, 8), 10);
|
|
|
+
|
|
|
+ // 定义星座边界
|
|
|
+ const constellationBoundaries = [
|
|
|
+ { name: '摩羯座', start: new Date(year, 0, 20) },
|
|
|
+ { name: '水瓶座', start: new Date(year, 1, 19) },
|
|
|
+ { name: '双鱼座', start: new Date(year, 2, 20) },
|
|
|
+ { name: '白羊座', start: new Date(year, 3, 20) },
|
|
|
+ { name: '金牛座', start: new Date(year, 4, 21) },
|
|
|
+ { name: '双子座', start: new Date(year, 5, 21) },
|
|
|
+ { name: '巨蟹座', start: new Date(year, 6, 22) },
|
|
|
+ { name: '狮子座', start: new Date(year, 7, 23) },
|
|
|
+ { name: '处女座', start: new Date(year, 8, 23) },
|
|
|
+ { name: '天秤座', start: new Date(year, 9, 23) },
|
|
|
+ { name: '天蝎座', start: new Date(year, 10, 23) },
|
|
|
+ { name: '射手座', start: new Date(year, 11, 22) },
|
|
|
+ { name: '摩羯座', start: new Date(year + 1, 0, 19) }, // 用于处理12月23日及之后的情况
|
|
|
+ ];
|
|
|
+
|
|
|
+ // 创建输入日期对象
|
|
|
+ const inputDate = new Date(year, month - 1, day);
|
|
|
+
|
|
|
+ // 查找对应的星座
|
|
|
+ for (let i = 0; i < constellationBoundaries.length - 1; i++) {
|
|
|
+ if (
|
|
|
+ inputDate >= constellationBoundaries[i].start &&
|
|
|
+ inputDate < constellationBoundaries[i + 1].start
|
|
|
+ ) {
|
|
|
+ return constellationBoundaries[i].name;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 默认返回摩羯座(理论上不会执行到这里)
|
|
|
+ return '摩羯座';
|
|
|
+ }
|
|
|
}
|