// 技術版APP 分享APP頁面 // // @authors hjboss <*****@*****.**> 2015-01-02# // @version 1.0.0 // @package hhxc define('HHXC', TRUE); require_once 'common.php'; $condition = array('schema' => 'hh_tuijian_code', 'filter' => array('code' => Assign($_REQUEST['needcode']), 'createdat' => date('Y-m-d'))); if (empty($_REQUEST['needcode']) == FALSE) { $buffer = StorageFind($condition); if (is_array($buffer) and empty($buffer) == FALSE) { $fields = array('number' => 'number+1'); StorageEdit($condition['schema'], $fields, $condition['filter']); } else { $data = array('code' => Assign($_REQUEST['needcode']), 'createdat' => date('Y-m-d'), 'number' => 1); StorageAdd($condition['schema'], $data); } } ?> <!DOCTYPE html> <html lang="zh-CN"> <head> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" /> <title>好好修车-免费修车老师,私人汽车医生!</title> <link rel="stylesheet" type="text/css" href="http://apps.bdimg.com/libs/bootstrap/3.3.4/css/bootstrap.min.css" /> <link rel="stylesheet" type="text/css" href="<?php echo URL_MOBILE; ?> /style.css" /> <script type="text/javascript" src="http://apps.bdimg.com/libs/jquery/1.10.2/jquery.min.js"></script>
$schema = ''; $data = array(); switch ($params['tag']) { case '3': $schema = 'hh_techqzhi'; $data = array('pubuser' => Assign($params['uid'], 0), 'type' => Assign($params['tag'], 0), 'tid' => Assign($params['tid'], 0), 'content' => Assign($params['content']), 'pubtime' => 'NOW()', 'anonymous' => Assign($params['anonymous']), 'no' => "(SELECT maxno FROM {$schema} WHERE id='{$params['tid']}')", 'at' => Assign($params['touid'], 0), 'atlist' => Assign($params['tolistid']), 'isnewat' => $is_newat); break; case '4': $schema = 'hh_zhaopin'; $data = array('pubuser' => Assign($params['uid'], 0), 'type' => Assign($params['tag'], 0), 'tid' => Assign($params['tid'], 0), 'content' => Assign($params['content']), 'pubtime' => 'NOW()', 'anonymous' => Assign($params['anonymous']), 'no' => "(SELECT maxno FROM {$schema} WHERE id='{$params['tid']}')", 'at' => Assign($params['touid'], 0), 'atlist' => Assign($params['tolistid']), 'isnewat' => $is_newat); break; default: $schema = 'hh_techforum'; $data = array('pubuser' => Assign($params['uid'], 0), 'type' => Assign($params['tag'], 0), 'tid' => Assign($params['tid'], 0), 'content' => Assign($params['content']), 'pubtime' => 'NOW()', 'anonymous' => Assign($params['anonymous']), 'no' => "(SELECT maxno FROM {$schema} WHERE id='{$params['tid']}')", 'at' => Assign($params['touid'], 0), 'atlist' => Assign($params['tolistid']), 'isnewat' => $is_newat); } $id = StorageAdd("{$schema}_list", $data); if (empty($id) == TRUE) { $result['msg'] = '发送失败!'; } else { $record = StorageFindID($schema, Assign($params['tid'], 0)); ## 更新更貼統計數據 $fields = array(); $column = ''; switch ($params['tag']) { case '3': $column = 'pubuser'; $fields = array('maxno' => 'maxno+1', 'replycount' => "(SELECT COUNT(*) FROM {$schema}_list WHERE tid='{$params['tid']}')", 'isnewmsg' => $record[$column] == $params['uid'] ? 0 : 1, 'isnewat' => empty($params['touid']) ? 0 : 1); break; case '4': $column = 'ofuser'; $fields = array('maxno' => 'maxno+1', 'replycount' => "(SELECT COUNT(*) FROM {$schema}_list WHERE tid='{$params['tid']}')", 'isnewmsg' => $record[$column] == $params['uid'] ? 0 : 1, 'isnewat' => empty($params['touid']) ? 0 : 1);
<?php // Copyright 2015 The Haohaoxiuche Team Authors. All right reserved. // Use of this source that is governed by a Apache-style // license that can be found in the LICENSE file. // // 技術版API編號105 案例跟貼 // // @authors hjboss <*****@*****.**> 2015-12-18# // @version 1.0.0 // @package hhxc if (!defined('HHXC')) { die('Permission denied'); } if (CheckOpenID($params['openid'], $params['uid']) == FALSE) { $result['msg'] = MESSAGE_WARNING; } else { $result = array('code' => '101', 'msg' => '提交成功!'); $data = array('uid' => Assign($params['uid'], 0), 'cid' => Assign($params['cid'], 0), 'tag' => 1, 'createdat' => date('Y-m-d H:i:s'), 'content' => Assign($params['context']), 'version' => 1); $id = StorageAdd('hh_anli_thread', $data); if (empty($id) == TRUE) { $result['msg'] = '提交失败!'; } }
die('Permission denied'); } if (CheckOpenID($params['openid'], $params['uid']) == FALSE) { $result['msg'] = MESSAGE_WARNING; } else { $result['msg'] = '点赞失败!'; $condition = array('schema' => 'hh_techuser_dianzan', 'filter' => array('uid' => Assign($params['uid'], 0), 'tid' => Assign($params['tid'], 0), 'tag' => Assign($params['tag'], 0), 'touid' => 0)); $record = StorageFindOne($condition); if (is_array($record) and empty($record) == FALSE) { $fields = array('type' => Assign($params['type'], 0)); $num = StorageEdit('hh_techuser_dianzan', $fields, $condition['filter']); $message = empty($params['type']) ? '取消成功!' : '点赞成功!'; $result = array('code' => '101', 'msg' => $message); } else { $data = array('uid' => Assign($params['uid'], 0), 'tid' => Assign($params['tid'], 0), 'tag' => Assign($params['tag'], 0), 'type' => Assign($params['type'], 0), 'deviceid' => Assign($params['deviceid']), 'touid' => 0); $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)); }
$out = ""; $out .= "addmulti({\n"; $out .= " id:\"" . $id . "\",\n"; foreach ($storage as $key => $array) { $out .= " " . $key . ":{stat:{min:" . round($range[$key]["min"], 3) . ", max:" . round($range[$key]["max"], 3) . ", avg:" . round($range[$key]["avg"], 3) . "}},\n"; } $out .= "});\n"; file_put_contents($fname, $out); } $key = "add({timestamp:"; $keyl = strlen($key); $f = fopen("data/" . $day . ".txt", "r"); while (!feof($f)) { $line = fgets($f); if (strlen($line) < 5) { continue; } $line = substr($line, 4, strlen($line) - 2); $args = JsonGetArray($line, "args"); $ts = JsonGetAttr($line, "timestamp"); if ($ts == "" || sizeof($args) == 0) { continue; } foreach ($args as $arg => $value) { StorageAdd($ts, $arg, $value); } } $simplified = Simplify($storage, 30); WriteStorage($simplified, "cache/" . $day . "_30.txt", $_GET["day"]); WriteStats($simplified, "cache/" . $day . "_stat.txt", $_GET["day"]); fclose($f);
// 技術版API編號014 發表汽修人跟帖 ##已取消 新接口014 // // @authors hjboss <*****@*****.**> 2015-12-16# // @version 1.0.0 // @package hhxc if (!defined('HHXC')) { die('Permission denied'); } if (CheckOpenID($params['openid'], $params['uid']) == FALSE) { $result['msg'] = MESSAGE_WARING; } else { $schema = 'hh_techforum_list'; $schema_s = 'hh_techforum'; if ($params['tag'] == '3') { $schema = 'hh_techqzhi_list'; $schema_s = 'hh_techqzhi'; } $data = array('pubuser' => Assign($params['uid'], 0), 'type' => Assign($params['tag'], 0), 'tid' => Assign($params['tid'], 0), 'content' => Assign($params['content']), 'pubtime' => 'NOW()', 'anonymous' => Assign($params['anonymous'], 0), 'no' => "(SELECT maxno FROM {$schema_s} WHERE id='{$params['tid']}')"); $id = StorageAdd($schema, $data); if (empty($id) == TRUE) { $result['msg'] = '发送失败!'; } else { $result = array('code' => '101', 'data' => array()); $fields = array('maxno' => 'maxno+1', 'replycount' => "(SELECT COUNT(*) FROM {$schema} WHERE tid='{$params['tid']}')"); StorageEditByID($schema_s, $fields, Assign($params['tid'], 0)); $record = StorageFindID($schema, $id, '*'); if (is_array($record) and empty($record) == FALSE) { $result['data'][] = array('posttime' => $record['pubtime'], 'index' => $record['no']); } } }
$condition = array('schema' => 'hh_identification', 'fields' => '*', 'filter' => array('uid' => Assign($params['uid'], 0))); $record = StorageFindOne($condition); ## 處理上傳圖片 $fileids = array(); $filekeys = array('fileid', 'filerz1', 'filerz2'); foreach ($filekeys as $number => $key) { $tmpname = "{$params['uid']}-{$number}-" . time() . ".png"; if ($_FILES[$key]['error'] <= 0 and empty($_FILES[$key]['tmp_name']) == FALSE) { $savepath = PIC_D_PATH . DIRECTORY_SEPARATOR . $tmpname; $fileids[$key] = $tmpname; move_uploaded_file($_FILES[$key]['tmp_name'], $savepath); } } if (is_array($record) == FALSE or empty($record) == TRUE) { $data = array('uid' => Assign($params['uid'], 0), 'name' => Assign($params['name']), 'identification' => Assign($params['identification']), 'fileid' => Assign($fileids['fileid']), 'filerz1' => Assign($fileids['filerz1']), 'filerz2' => Assign($fileids['filerz2']), 'deviceid' => Assign($params['deviceid']), 'status' => 2); $id = StorageAdd('hh_identification', $data); } else { $data = array('name' => Assign($params['name']), 'identification' => Assign($params['identification']), 'deviceid' => Assign($params['deviceid'])); if ($fileids['fileid']) { $data['fileid'] = $fileids['fileid']; } if ($fileids['filerz1']) { $data['filerz1'] = $fileids['filerz1']; } if ($fileids['filerz2']) { $data['filerz2'] = $fileids['filerz2']; } $num = StorageEdit('hh_identification', $data, array('uid' => Assign($params['uid'], 0))); } $result = array('code' => '101', 'msg' => MESSAGE_SUCCESS, 'fields' => $fields); }
$params['message'] = SMS_ACTION_BANDINGS . $chars; break; case '2': $condition = array('schema' => 'hh_techuser', 'filter' => array('username_d' => Assign($params['phone']))); if (empty($params['phoneaes']) == FALSE) { $condition['filter']['username'] = Assign($params['phoneaes']); } $record = StorageFindOne($condition); if (is_array($record) == FALSE or empty($record) == TRUE) { $result['msg'] = '该号码不存在!'; die(JsonEncode($result)); } $params['message'] = SMS_ACTION_PASSWORD . $chars; break; } ## 發送短信 if (SMS($params['phone'], $params['message']) == FALSE) { $result['msg'] = '发送失败!'; die(JsonEncode($result)); } $result = array('code' => '101', 'data' => $chars); ## 統計短信發送 $condition = array('schema' => 'hh_sms_log', 'filter' => array('createdat' => date('Y-m-d'))); $record = StorageFindOne($condition); if (is_array($record) and empty($record) == FALSE) { $fields = array("status{$params['opt']}" => "status{$params['opt']}+1"); StorageEdit('hh_sms_log', $fields, $condition['filter']); } else { $data = array("status{$params['opt']}" => 1, 'createdat' => date('Y-m-d')); StorageAdd('hh_sms_log', $data); }
<?php // Copyright 2015 The Haohaoxiuche Team Authors. All right reserved. // Use of this source that is governed by a Apache-style // license that can be found in the LICENSE file. // // 技術版API編號013 發表汽修人新貼 // // @authors hjboss <*****@*****.**> 2015-12-16# // @version 1.0.0 // @package hhxc if (!defined('HHXC')) { die('Permission denied'); } if (CheckOpenID($params['openid'], $params['uid']) == FALSE) { $result['msg'] = MESSAGE_WARNING; } else { $data = array('pubuser' => Assign($params['uid'], 0), 'type' => Assign($params['tag'], 1), 'title' => Assign($params['title']), 'content' => Assign($params['content']), 'pubtime' => 'NOW()', 'anonymous' => Assign($params['anonymous'], 0)); $num = StorageAdd('hh_techforum', $data); if (empty($num) == TRUE) { $result['msg'] = '发送失败!'; } else { $result = array('code' => '101', 'data' => array()); $record = StorageFindID('hh_techforum', $num); if (is_array($record) and empty($record) == FALSE) { $result['data'][] = array('posttime' => $record['pubtime'], 'tid' => $record['id']); } } }
$schema = 'hh_zhaopin'; $data = array('pubuser' => Assign($params['uid'], 0), 'type' => Assign($params['tag'], 0), 'tid' => Assign($params['tid'], 0), 'content' => Assign($params['content']), 'pubtime' => 'NOW()', 'anonymous' => Assign($params['anonymous']), 'no' => "(SELECT maxno FROM {$schema} WHERE id='{$params['tid']}')", 'at' => Assign($params['touid'], 0), 'atlist' => Assign($params['tolistid']), 'isnewat' => $is_newat); break; default: $schema = 'hh_techforum'; $data = array('pubuser' => Assign($params['uid'], 0), 'type' => Assign($params['tag'], 0), 'tid' => Assign($params['tid'], 0), 'content' => Assign($params['content']), 'pubtime' => 'NOW()', 'anonymous' => Assign($params['anonymous']), 'no' => "(SELECT maxno FROM {$schema} WHERE id='{$params['tid']}')", 'at' => Assign($params['touid'], 0), 'atlist' => Assign($params['tolistid']), 'isnewat' => $is_newat); } $id = StorageAdd("{$schema}_list", $data); if (empty($id) == TRUE) { $result['msg'] = '发送失败!'; } else { for ($index = 0; $index < 6; $index++) { $field = 'image' . strval($index + 1); if ($_FILES[$field]['error'] <= 0 and empty($_FILES[$field]['tmp_name']) == FALSE) { $buf_data = array('listid' => $id, 'createdat' => 'NOW()', 'filename' => $_FILES[$field]['name'], 'size' => $_FILES[$field]['size']); $buf_id = StorageAdd("{$schema}_list_img", $buf_data); $upload_path = ''; switch ($params['tag']) { case '3': $upload_path = PIC_Q_PATH; break; case '4': $upload_path = PIC_Z_PATH; break; default: $upload_path = PIC_L_PATH; } $uploadfile = $upload_path . DIRECTORY_SEPARATOR . "{$buf_id}.png"; $uploadfile_s = $upload_path . DIRECTORY_SEPARATOR . "{$buf_id}_s.png"; move_uploaded_file($_FILES[$field]['tmp_name'], $uploadfile); MakeSmallIMG($uploadfile, $uploadfile_s);
<?php // Copyright 2015 The Haohaoxiuche Team Authors. All right reserved. // Use of this source that is governed by a Apache-style // license that can be found in the LICENSE file. // // 技術版API編號008 發送正在解決問題的回復 // // @authors hjboss <*****@*****.**> 2015-12-14# // @version 1.0.0 // @package hhxc if (!defined('HHXC')) { die('Permission denied'); } if (CheckOpenID($params['openid'], $params['uid']) == FALSE) { $result['msg'] = MESSAGE_WARNING; } else { $data = array('uid' => Assign($params['uid'], 0), 'qid' => Assign($params['qid'], 0), 'content' => Assign($params['content']), 'pubtime' => 'NOW()', 'no' => "(SELECT maxno FROM hh_questions WHERE id='{$params['qid']}')+1", 'type' => 1); $id = StorageAdd('hh_questions_list', $data); if (empty($id) == TRUE) { $result['msg'] = '发送失败!'; } else { $result = array('code' => '101', 'data' => array()); StorageEdit('hh_questions', array('maxno' => 'maxno+1'), array('id' => $params['qid'])); $buf = StorageFindID('hh_questions_list', $id); if (is_array($buf) and empty($buf) == FALSE) { $result['data'][] = array('posttime' => $buf['pubtime'], 'index' => $buf['no']); } } }
<?php // Copyright 2015 The Haohaoxiuche Team Authors. All right reserved. // Use of this source that is governed by a Apache-style // license that can be found in the LICENSE file. // // 技術版API編號090 汽修人之招聘新貼 // // @authors hjboss <*****@*****.**> 2015-12-18# // @version 1.0.0 // @package hhxc if (!defined('HHXC')) { die('Permission denied'); } if (CheckOpenID($params['openid'], $params['uid']) == FALSE) { $result['msg'] = MESSAGE_WARNING; } else { $data = array('ofuser' => Assign($params['uid'], 0), 'job' => Assign($params['job']), 'salary' => Assign($params['salary']), 'headcount' => Assign($params['headcount']), 'city' => Assign($params['city']), 'contactinfo' => Assign($params['contactinfo']), 'boon' => Assign($params['boon']), 'business' => Assign($params['business']), 'scale' => Assign($params['scale']), 'name' => Assign($params['name']), 'location' => Assign($params['location']), 'etc' => Assign($params['etc']), 'createdat' => 'NOW()'); $id = StorageAdd('hh_zhaopin', $data); if (empty($id)) { $result['msg'] = '发送失败!'; } else { $result = array('code' => '101', 'data' => array()); $record = StorageFindID('hh_zhaopin', $id); if (empty($record) == FALSE) { $result['data'][] = array('posttime' => $record['createdat'], 'tid' => $record['id']); } } }
// // @authors hjboss <*****@*****.**> 2015-12-16# // @version 1.0.0 // @package hhxc if (!defined('HHXC')) { die('Permission denied'); } if (CheckOpenID($params['openid'], $params['uid']) == FALSE) { $result['msg'] = MESSAGE_WARNING; } else { $num = 0; switch ($params['type']) { case '1': $fields = array('lockby' => $params['uid'], 'locktime' => 'NOW()', 'zhuangtai' => 1); $filter = array('id' => Assign($params['qid'], 0), 'lockby' => 0, 'zhuangtai' => 0); $num = StorageEdit('hh_questions', $fields, $filter); break; case '2': $data = array('ofq' => Assign($params['qid'], 0), 'ofuser' => Assign($params['uid'], 0), 'createdat' => 'NOW()'); $id = StorageAdd('hh_questions_diff', $data); if (empty($id) == FALSE) { $num = StorageEditByID('hh_questions', array('difficulty' => 'difficulty+1'), $params['qid']); } break; } if (empty($num) == FALSE) { $result = array('code' => '101', 'msg' => MESSAGE_SUCCESS); } else { $result['msg'] = '问题已被其他人抢答!'; } }
<?php // Copyright 2015 The Haohaoxiuche Team Authors. All right reserved. // Use of this source that is governed by a Apache-style // license that can be found in the LICENSE file. // // 技術版API編號001 用戶首次安裝軟件提交設備ID // // @authors hjboss <*****@*****.**> 2015-12-14# // @version 1.0.0 // @package hhxc if (!defined('HHXC')) { die('Permission denied'); } //var_dump(RefreshMsgByDianzan(89, 4, 0));die; $record = array('deviceid' => Assign($params['deviceid']), 'type' => strtoupper(Assign($params['device'])), 'createdat' => 'NOW()'); if (StorageAdd('hh_device', $record)) { $result = array('code' => '101', 'msg' => MESSAGE_SUCCESS); }
// @package hhxc if (!defined('HHXC')) { die('Permission denied'); } $condition = array('schema' => 'hh_techuser', 'fields' => '*', 'filter' => array('thirduid' => Assign($params['uid'], 0))); $record = StorageFindOne($condition); $uid = 0; $old_img = ''; $img_path = ''; if (is_array($record) and empty($record) == FALSE) { $uid = $record['id']; $old_img = $record['headerimg']; } else { $img_path = get_threeimg($params['uid'], $params['iconurl']); $data = array('thirduid' => Assign($params['uid'], 0), 'nick' => Assign($params['nick']), 'city' => Assign($params['city']), 'tag' => Assign($params['tag'], 0), 'headerimg' => $img_path); $uid = StorageAdd('hh_techuser', $data); } if (empty($uid) == TRUE) { $result['msg'] = '登陆不存在!'; } else { $record = StorageFindOne($condition); if (is_array($record) == FALSE or empty($record) == TRUE) { $result['msg'] = '登陆失败!'; } else { $fields = array('loginid' => md5($params['uid'] . $params['pwd'] . time()), 'deviceid' => Assign($params['deviceid'])); StorageEditByID('hh_techuser', $fields, $uid); if (empty($old_img) == TRUE) { $img_path = get_threeimg($params['uid'], $params['iconurl']); StorageEditByID('hh_techuser', array('headerimg' => $img_path), $uid); } $result = array('code' => '101', 'data' => array());
<?php // Copyright 2015 The Haohaoxiuche Team Authors. All right reserved. // Use of this source that is governed by a Apache-style // license that can be found in the LICENSE file. // // 技術版API編號075 提交案例評分 // // @authors hjboss <*****@*****.**> 2015-12-18# // @version 1.0.0 // @package hhxc if (!defined('HHXC')) { die('Permission denied'); } if (CheckOpenID($params['openid'], $params['uid']) == FALSE) { $result['msg'] = MESSAGE_WARNING; } else { $data = array('ofuser' => Assign($params['uid'], 0), 'createdat' => 'NOW()', 'ofanli' => Assign($params['cid'], 0), 'score' => Assign($params['score'], 0)); $id = StorageAdd('car_anli_score', $data); if (empty($id) == TRUE) { $result['msg'] = '重复保存!'; } else { $avg = "(SELECT SUM(score)/COUNT(id) FROM car_anli_score WHERE ofanli='%d')"; $fields = array('score_avg' => sprintf($avg, $params['cid'])); StorageEditByID('search_result', $fields, $params['cid']); ## 更新用戶積分 Techuser_setScore(Assign($params['uid'], 0), 5); $result = array('code' => '101', 'msg' => MESSAGE_SUCCESS); } }
<?php // Copyright 2015 The Haohaoxiuche Team Authors. All right reserved. // Use of this source that is governed by a Apache-style // license that can be found in the LICENSE file. // // 技術版API編號020 汽修人之發布求職新貼 // // @authors hjboss <*****@*****.**> 2015-12-17# // @version 1.0.0 // @package hhxc if (!defined('HHXC')) { die('Permission denied'); } if (CheckOpenID($params['openid'], $params['uid']) == FALSE) { $result['msg'] = MESSAGE_WARING; } else { $data = array('pubuser' => Assign($params['uid'], 0), 'pubtime' => 'NOW()', 'level' => Assign($params['level']), 'experience' => Assign($params['experience']), 'city' => Assign($params['city']), 'cars' => Assign($params['cars']), 'job' => Assign($params['job']), 'introduce' => Assign($params['introduce'])); $id = StorageAdd('hh_techqzhi', $data); if (empty($id) == TRUE) { $result['msg'] = '发送失败!'; } else { $result = array('code' => '101', 'data' => array()); $record = StorageFindID('hh_techqzhi', $id); if (is_array($record) and empty($record) == FALSE) { $result['data'][] = array('posttime' => $record['pubtime'], 'tid' => $record['id']); } } }
function Techuser_search($uid, $content, $type, $word_id = array(), $count = 0) { if (is_array($word_id)) { $word_id = join($word_id, ','); } $data = array('ofuser' => $uid, 'content' => $content, 'createdat' => 'NOW()', 'type' => $type, 'wordid' => $word_id, 'resultcount' => $count); $id = StorageAdd('hh_techuser_search', $data); if (empty($id) == FALSE) { return $id; } return FALSE; }
// Use of this source that is governed by a Apache-style // license that can be found in the LICENSE file. // // 技術版API編號099 汽修人收藏 // // @authors hjboss <*****@*****.**> 2015-12-18# // @version 1.0.0 // @package hhxc if (!defined('HHXC')) { die('Permission denied'); } if (CheckOpenID($params['openid'], $params['uid']) == FALSE) { $result['msg'] = MESSAGE_WARNING; } else { $result['msg'] = '收藏失败!'; $condition = array('schema' => 'hh_techuser_shoucang', 'filter' => array('uid' => Assign($params['uid'], 0), 'tid' => Assign($params['tid'], 0), 'tag' => Assign($params['tag'], 0))); $record = StorageFindOne($condition); if (is_array($record) and empty($record) == FALSE) { $fields = array('type' => Assign($params['type'], 0)); $num = StorageEdit('hh_techuser_shoucang', $fields, $condition['filter']); $message = empty($params['type']) ? '取消成功!' : '收藏成功!'; $result = array('code' => '101', 'msg' => $message); } else { $data = array('uid' => Assign($params['uid'], 0), 'tid' => Assign($params['tid'], 0), 'tag' => Assign($params['tag'], 0), 'type' => Assign($params['type'], 0), 'deviceid' => Assign($params['deviceid'])); $id = StorageAdd('hh_techuser_shoucang', $data); if (empty($id) == FALSE) { $message = empty($params['type']) ? '取消成功!' : '收藏成功!'; $result = array('code' => '101', 'msg' => $message); } } }
} else { $result['msg'] = ''; } } } if (empty($result['msg']) == TRUE or empty($params['reward']) == TRUE) { $data = array('pubuser' => Assign($params['uid'], 0), 'type' => Assign($params['tag'], 0), 'title' => Assign($params['title']), 'content' => Assign($params['context']), 'pubtime' => 'NOW()', 'anonymous' => Assign($params['anonymous'], 0), 'reward' => Assign($params['reward'], 0), 'rewarded' => empty($params['reward']) ? 0 : $rankscore); $id = StorageAdd('hh_techforum', $data); if (empty($id) == TRUE) { $result['msg'] = MESSAGE_ERROR; } else { for ($index = 0; $index < 6; $index++) { $field = 'image' . strval($index + 1); if ($_FILES[$field]['error'] <= 0 and empty($_FILES[$field]['tmp_name']) == FALSE) { $buf_data = array('qid' => $id, 'createdat' => 'NOW()', 'filename' => $_FILES[$field]['name'], 'size' => $_FILES[$field]['size']); $buf_id = StorageAdd('hh_techforum_img', $buf_data); $uploadfile = PIC_F_PATH . DIRECTORY_SEPARATOR . "{$buf_id}.png"; $uploadfile_s = PIC_F_PATH . DIRECTORY_SEPARATOR . "{$buf_id}_s.png"; move_uploaded_file($_FILES[$field]['tmp_name'], $uploadfile); MakeSmallIMG($uploadfile, $uploadfile_s); } } $result = array('code' => '101', 'data' => array()); $record = StorageFindID('hh_techforum', $id); if (is_array($record) and empty($record) == FALSE) { $result['data'][] = array('posttime' => $record['pubtime'], 'tid' => $record['id']); } ## 设置用戶可兌換積分 if (empty($rankscore) == FALSE) { $message = sprintf(RANKSCORE_ASK, $data['title'], $params['reward']); Techuser_setRankscore($params['uid'], 0 - $rankscore, $message);
// @version 1.0.0 // @package hhxc if (!defined('HHXC')) { die('Permission denied'); } $buf_caseid = empty($params['cid']) ? Assign($params['caseid'], 0) : Assign($params['cid'], 0); $condition = array('schema' => 'hh_techuser_shoucang', 'filter' => array('uid' => Assign($params['uid'], 0), 'tid' => Assign($params['cid'], 0), 'tag' => '5')); $record = StorageFindOne($condition); if (is_array($record) == FALSE or empty($record) == TRUE) { $data = array('uid' => Assign($params['uid'], 0), 'tid' => $buf_caseid, 'tag' => 5, 'type' => Assign($params['type'], 0), 'deviceid' => Assign($params['deviceid'])); $id = StorageAdd('hh_techuser_shoucang', $data); if (empty($id) == TRUE) { $result['msg'] = '收藏失敗!'; } else { $result = array('code' => '101', 'msg' => $params['type'] == 1 ? '收藏成功!' : '取消收藏!'); ## 兼容舊版數據表 $data_sub = array('ofuser' => Assign($params['uid'], 0), 'createdat' => 'NOW()', 'ofanli' => $buf_caseid, 'search' => ''); StorageAdd('hh_techuser_anli', $data_sub); } } else { $fields = array('uid' => Assign($params['uid'], 0), 'tid' => $buf_caseid, 'tag' => 5, 'type' => Assign($params['type'], 0), 'deviceid' => Assign($params['deviceid'])); $num = StorageEdit('hh_techuser_shoucang', $fields, $condition['filter']); if (empty($num) == TRUE) { $result['msg'] = '收藏失敗!'; } else { $result = array('code' => '101', 'msg' => $params['type'] == 1 ? '收藏成功!' : '取消收藏!'); } } if (CheckOpenID($params['openid'], $params['uid']) == TRUE) { Techuser_setScore($params['uid'], 3); }