$id = StorageAdd('hh_techuser_dianzan', $data); if (empty($id) == FALSE) { $message = empty($params['type']) ? '取消成功!' : '点赞成功!'; $result = array('code' => '101', 'msg' => $message); } } ## 更新點贊通知 $schemas = array('1' => 'hh_techforum', '2' => 'hh_techforum', '3' => 'hh_techqzhi', '4' => 'hh_zhaopin'); $info = StorageFindID($schemas[$params['tag']], Assign($params['tid'], 0)); $pubuser = $params['tag'] == '4' ? 'ofuser' : 'pubuser'; if (empty($schemas[$params['tag']]) == FALSE and $info[$pubuser] != $params['uid']) { $isnewdz = array('isnewdz' => $params['type'] === '1' ? 1 : 0); StorageEditByID($schemas[$params['tag']], $isnewdz, Assign($params['tid'], 0)); ## 被點贊的樓主更新通知 RefreshMsg(Assign($info[$pubuser], 0)); } ## 推送消息 if ($params['type'] == '1') { $schema = 'hh_techforum'; switch ($params['tag']) { case '3': $schema = 'hh_techqzhi'; break; case '4': $schema = 'hh_zhaopin'; break; } $params['touid'] = 0; JPushMessage("1030{$params['tag']}", $params, $schema); } }
break; default: $column = 'pubuser'; $fields = array('maxno' => 'maxno+1', 'replycount' => "(SELECT COUNT(*) FROM {$schema}_list WHERE tid='{$params['tid']}')", 'isnewmsg' => ($record[$column] != $params['uid'] and $params['touid'] === '0') ? 1 : 0, 'isnewat' => $params['touid'] === '0' ? 0 : 1); } StorageEditByID($schema, $fields, Assign($params['tid'], 0)); $result = array('code' => '101', 'data' => array()); ## 獲取更貼人信息 $condition = array('schema' => array("{$schema}_list"), 'fields' => array('*'), 'filter' => array('t0.id' => $id)); if ($params['touid'] !== '0') { $condition['fields'][] = "at AS h_pubuser"; } else { $condition['fields'][] = "(SELECT {$column} FROM {$schema} WHERE id=t0.tid) AS h_pubuser"; } $buf = StorageFindOne($condition); if (is_array($buf) and empty($buf) == FALSE) { $result['data'][] = array('posttime' => $buf['pubtime'], 'index' => $buf['no'], 'listid' => $buf['id']); } ## 更新相關用戶消息 RefreshMsg(Assign($parmas['uid'], 0)); RefreshMsg(Assign($params['touid'], 0)); RefreshMsg(Assign($buf['h_pubuser'], 0)); ## 添加經驗值 if ($params['tag'] == '1') { Techuser_setRank($params['uid'], 1); } ## 推送消息 $message_no = '10' . ($params['touid'] == '0' ? '1' : '2') . "0{$params['tag']}"; JPushMessage($message_no, $params, $schema); } }