getint('id'); $csql = new \ciy\sql('ap_pnt_track'); $csql->where('id', $id); $trackrow = $db->getone($csql); if (!is_array($trackrow)) return errjson('埋点不存在' . $id); $point = $trackrow['point']; $updata = array(); $updata['vuser'] = $rsuser['id']; $updata['fromid'] = $id; $updata['name'] = $trackrow['name']; $updata['pnt'] = $point; $updata['addtimes'] = tostamp(); $csql = new \ciy\sql('ap_pnt_record'); $db->insert($csql, $updata); $db->execute('update ap_user set mypnt=mypnt+' . $point . ' where id=' . $rsuser['id']); $msg = ''; if ($id == 1) $msg = '已签到 +' . $point . ' 积分'; $ret['msg'] = $msg; return succjson($ret); } public static function json_signpath() { $rsuser = verifyfast(); $post = new \ciy\post(); $path = $post->get('path'); //'/pages/main/index'; $ret['sign'] = hash_hmac('sha256', $path, $rsuser['wxminakey'], false); $ret['path'] = $path; return succjson($ret); } public static function json_part_vent() { global $db; $rsuser = verifyfast(); $post = new \ciy\post(); $id = $post->getint('id'); $sectionid = $post->getint('sectionid'); $content = $post->get('content'); $updata = array(); $updata['artid'] = $id; $updata['sectionid'] = $sectionid; $updata['content'] = $content; $updata['pubtimes'] = time(); $updata['audituser'] = 0; $updata['vuser'] = $rsuser['id']; $csql = new \ciy\sql('ap_art_vent'); $db->insert($csql, $updata); return succjson(); } public static function json_part_hot() { global $db; $post = new \ciy\post(); $id = $post->getint('id'); $sec = $post->getint('sec'); $updata = array(); $updata['studycnt'] = array('studycnt+1'); $csql = new \ciy\sql('ap_art_post'); $csql->where('id', $id); $db->update($csql, $updata); return succjson(); } public static function json_part_init() { global $db; $post = new \ciy\post(); $id = $post->getint('id'); $csql = new \ciy\sql('ap_art_post'); $csql->where('id', $id); $artrow = $db->getone($csql); if (!is_array($artrow)) return errjson('文章不存在' . $id); $sectionid = $artrow['sectionid']; $csql = new \ciy\sql('ap_art_section'); $csql->where('id', $sectionid); $sectionrow = $db->getone($csql); if (!is_array($sectionrow)) return errjson('板块不存在' . $sectionid); $ret['data'] = $artrow; $ret['section'] = $sectionrow; $updata = array(); $updata['readcnt'] = array('readcnt+1'); $csql = new \ciy\sql('ap_art_post'); $csql->where('id', $id); $db->update($csql, $updata); return succjson($ret); } public static function json_psection_list() { global $db; $post = new \ciy\post(); $sectionid = $post->getint('id'); $csql = new \ciy\sql('ap_art_section'); $csql->where('id', $sectionid); $sectionrow = $db->getone($csql); if (!is_array($sectionrow)) return errjson('板块不存在' . $sectionid); $query = $post->get('query'); $csql = new \ciy\sql('ap_art_post'); $csql->where('sectionid', $sectionid); $csql->where('artstatus', 100); $csql->where('name like', objstr($query, 'key')); $csql->column('id,name,img,descs'); $csql->order('artsort desc, id desc'); $pageno = $post->getint('pageno', 1); $pagecount = $post->getint('pagecount', 10); $csql->limit($pageno, $pagecount); $rows = $db->get($csql); $ret = array('pageno' => $pageno, 'pagecount' => $pagecount, 'list' => $rows); if ($post->getbool('once')) { $ret['once'] = true; $ret['section'] = $sectionrow; } return succjson($ret); } public static function json_paper_get() { global $db; $post = new \ciy\post(); $db->trace($post->get('_pf')); $id = $post->getint('id'); $csql = new \ciy\sql('ap_paper'); $csql->where('id', $id); $artrow = $db->getone($csql); if (!is_array($artrow)) return errjson('文章不存在' . $id); $ret = array('data' => $artrow); $updata = array(); $updata['readcnt'] = array('readcnt+1'); $csql = new \ciy\sql('ap_paper'); $csql->where('id', $id); $db->update($csql, $updata); return succjson($ret); } public static function json_index_init() { global $db; $post = new \ciy\post(); $csql = new \ciy\sql('ap_banner'); $csql->where('groupcode', 'index'); $row = $db->get($csql); $ret['banner'] = $row; $csql = new \ciy\sql('demo_normal'); $csql->order('id desc'); $csql->limit(1, 8); $rows = $db->get($csql); $ret['demos'] = $rows; $ret['zc_menu'] = getrelation($db, $rows, 'zc_menu', 'menuid', 'id,name'); $ret['sharename'] = '分享主标题,千人千面'; return succjson($ret); } public static function json_me_init() { global $db; $csql = new \ciy\sql('ap_usr_buy_bundle'); $ret['userbuys'] = $db->get($csql); $ret['recommend'] = 2; return succjson($ret); } }