package unicom import ( "context" "database/sql" "time" "go-common/app/interface/main/app-wall/conf" "go-common/app/interface/main/app-wall/model/unicom" "go-common/library/cache/memcache" "go-common/library/database/elastic" xsql "go-common/library/database/sql" "go-common/library/log" httpx "go-common/library/net/http/blademaster" ) const ( //unicom _inOrderSyncSQL = `INSERT IGNORE INTO unicom_order (usermob,cpid,spid,type,ordertime,canceltime,endtime,channelcode,province,area,ordertype,videoid,ctime,mtime) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?) ON DUPLICATE KEY UPDATE cpid=?,spid=?,type=?,ordertime=?,canceltime=?,endtime=?,channelcode=?,province=?,area=?,ordertype=?,videoid=?,mtime=?` _inAdvanceSyncSQL = `INSERT IGNORE INTO unicom_order_advance (usermob,userphone,cpid,spid,ordertime,channelcode,province,area,ctime,mtime) VALUES(?,?,?,?,?,?,?,?,?,?) ON DUPLICATE KEY UPDATE cpid=?,spid=?,ordertime=?,channelcode=?,province=?,area=?,mtime=?` _upOrderFlowSQL = `UPDATE unicom_order SET time=?,flowbyte=?,mtime=? WHERE usermob=?` _orderUserSyncSQL = `SELECT usermob,cpid,spid,type,ordertime,canceltime,endtime,channelcode,province,area,ordertype,videoid,time,flowbyte FROM unicom_order WHERE usermob=? ORDER BY type DESC` _inIPSyncSQL = `INSERT IGNORE INTO unicom_ip (ipbegion,ipend,provinces,isopen,opertime,sign,ctime,mtime) VALUES(?,?,?,?,?,?,?,?) ON DUPLICATE KEY UPDATE ipbegion=?,ipend=?,provinces=?,isopen=?,opertime=?,sign=?,mtime=?` _ipSyncSQL = `SELECT ipbegion,ipend FROM unicom_ip WHERE isopen=1` //pack _inPackSQL = `INSERT IGNORE INTO unicom_pack (usermob,mid) VALUES(?,?)` _packSQL = `SELECT usermob,mid FROM unicom_pack WHERE usermob=?` // update unicom ip _inUnicomIPSyncSQL = `INSERT IGNORE INTO unicom_ip (ipbegion,ipend,isopen,ctime,mtime) VALUES(?,?,?,?,?) ON DUPLICATE KEY UPDATE ipbegion=?,ipend=?,isopen=?,mtime=?` _upUnicomIPSQL = `UPDATE unicom_ip SET isopen=?,mtime=? WHERE ipbegion=? AND ipend=?` // unicom integral change _inUserBindSQL = `INSERT IGNORE INTO unicom_user_bind (usermob,phone,mid,state,integral,flow) VALUES(?,?,?,?,?,?) ON DUPLICATE KEY UPDATE phone=?,state=?` _userBindSQL = `SELECT usermob,phone,mid,state,integral,flow,monthlytime FROM unicom_user_bind WHERE state=1 AND mid=?` _userBindPhoneMidSQL = `SELECT mid FROM unicom_user_bind WHERE phone=? AND state=1` _upUserIntegralSQL = `UPDATE unicom_user_bind SET integral=?,flow=? WHERE phone=? AND mid=?` _userPacksSQL = `SELECT id,ptype,pdesc,amount,capped,integral,param FROM unicom_user_packs WHERE state=1` _userPacksByIDSQL = `SELECT id,ptype,pdesc,amount,capped,integral,param,state FROM unicom_user_packs WHERE id=?` _upUserPacksSQL = `UPDATE unicom_user_packs SET amount=?,state=? WHERE id=?` _inUserPackLogSQL = `INSERT INTO unicom_user_packs_log (phone,usermob,mid,request_no,ptype,integral,pdesc) VALUES (?,?,?,?,?,?,?)` _userBindOldSQL = `SELECT usermob,phone,mid,state,integral,flow FROM unicom_user_bind WHERE phone=? ORDER BY mtime DESC limit 1` _userPacksLogSQL = `SELECT phone,integral,ptype,pdesc FROM unicom_user_packs_log WHERE mtime>=? AND mtime