Exemple #1
0
 public function storeContent()
 {
     $name = $_POST['name'];
     $final = $_POST['final'];
     $advantages = $_POST['ad'];
     $disadvantages = $_POST['dis'];
     $retID = pass_passService::getUid();
     if (!$retID) {
         $result['errNum'] = '0007';
         $result['errMsg'] = errorcode::$error[$result['errNum']];
         $this->renderJson($result);
     }
     $content = array('name' => $name, 'final' => $final, 'ad' => $advantages, 'dis' => $disadvantages);
     $redis = redisModel::getInstance();
     $key = sprintf(self::REDIS_DECISION_USER_KEY, $retID);
     $ret = $redis::$redis->lPush($key, json_encode($content));
     if (!$ret) {
         log::warning("redis write error", "log.wf");
         $result['errNum'] = '0005';
         $result['errMsg'] = errorcode::$error[$result['errNum']];
         $this->renderJson($result);
     }
     $result['errNum'] = '0000';
     $result['errMsg'] = errorcode::$error[$result['errNum']];
     $this->renderJson($result);
 }
Exemple #2
0
 public function getUid()
 {
     $retID = pass_passService::getUid();
     if ($retID) {
         $result['errNum'] = '0000';
         $result['errMsg'] = errorcode::$error[$result['errNum']];
         $result['userId'] = $retID;
     } else {
         $result['errNum'] = '0007';
         $result['errMsg'] = errorcode::$error[$result['errNum']];
     }
     $this->renderJson($result);
 }
Exemple #3
0
 public function getContent()
 {
     $retID = pass_passService::getUid();
     if (!$retID) {
         $result['errNum'] = '0007';
         $result['errMsg'] = errorcode::$error[$result['errNum']];
         $this->renderJson($result);
     }
     $redis = redisModel::getInstance();
     $key = sprintf(self::REDIS_DECISION_USER_KEY, $retID);
     $ret = $redis::$redis->lRange($key, 0, 9);
     foreach ($ret as $key => $value) {
         $ret[$key] = json_decode($value, true);
     }
     if (empty($ret)) {
         $result['errNum'] = '0008';
         $result['errMsg'] = errorcode::$error[$result['errNum']];
         $this->renderJson($result);
     }
     $result['errNum'] = '0000';
     $result['errMsg'] = errorcode::$error[$result['errNum']];
     $result['content'] = $ret;
     $this->renderJson($result);
 }