public function updateptkAction() { $p = $_REQUEST; $pCid = empty($p['cid']) ? '' : trim($p['cid']); $pDid = empty($p['did']) ? '' : trim($p['did']); $pDevicetoken = empty($p['devicetoken']) ? '' : trim($p['devicetoken']); $tTime = time(); if (!Tool_Validate::az09($pCid)) { Tool_Fnc::ajaxMsg('cid 错误'); } if (!Tool_Validate::az09($pDid)) { Tool_Fnc::ajaxMsg('Did 错误'); } if (!empty($pDevicetoken) && !Tool_Validate::az09($pDevicetoken)) { Tool_Fnc::ajaxMsg('devicetoken 错误'); } $tGMO = new GetuiModel(); $tGMORow = $tGMO->field('count(0) c')->where('did = \'' . $pDid . '\' and cid = \'' . $pCid . '\' and devicetoken = \'' . $pDevicetoken . '\'')->fRow(); if (!empty($tGMORow['c'])) { Tool_Fnc::ajaxMsg('did 关联存在', 1); } $tData = array('devicetoken' => $pDevicetoken, 'cid' => $pCid, 'did' => $pDid, 'created' => $tTime); if (!$tGMO->insert($tData)) { Tool_Fnc::ajaxMsg('更新 push token失败'); } Tool_Fnc::ajaxMsg('操作成功', 1); }
public function sent($pDid) { $tMO = new GetuiModel(); $tRow = $tMO->field('devicetoken,cid')->where('did = \'' . $pDid . '\'')->fRow(); if (!count($tRow)) { return false; } $tRedis = Cache_Redis::instance(); $tRow['title'] = '拍医拍'; $tRow['content'] = '您的意见反馈我们已经处理'; $tData = serialize($tRow); $tRedis->lpush('dakang_msg', $tData); }
public function indexAction() { $tTime = time(); $tMO = new ArticleModel(); $tDatas = $tMO->field('title,id,description')->where('is_tui = 0 and status = 1 and push_time <= ' . $tTime)->fList(); print_R($tDatas); if (!count($tDatas)) { exit; } $tGMO = new GetuiModel(); $tGDatas = $tGMO->field('devicetoken,cid')->fList(); $tRedis = Cache_Redis::instance(); foreach ($tDatas as $tRow) { foreach ($tGDatas as $tR) { $tRes = serialize(array_merge($tRow, $tR, array('type' => 'article', 'content' => ''))); $tRedis->lpush('dakang_getui', $tRes); } $tData = array('is_tui' => 1, 'id' => $tRow['id']); $tMO->update($tData); } exit; }