Пример #1
0
 /**
  * 更新关注数
  * @param $id
  * @return bool
  */
 public static function updateFollows($id)
 {
     $sql = 'UPDATE question_answer SET answer_follows = (SELECT COUNT(*) FROM question_answer_follow WHERE answer_id=question_answer.answer_id) WHERE answer_id = :aid';
     $model = new self();
     return $model->getWriteConnection()->execute($sql, ['aid' => $id]);
 }
Пример #2
0
 /**
  * 更新回答数
  * @param $id
  * @return bool
  */
 public static function updateAnswerNum($id)
 {
     $sql = 'UPDATE question SET answer_num = (SELECT COUNT(*) FROM question_answer WHERE question_id=question.question_id AND answer_state > 0) WHERE question_id = :qid';
     $model = new self();
     return $model->getWriteConnection()->execute($sql, ['qid' => $id]);
 }
Пример #3
0
 public static function updateAssist($id)
 {
     $sql = 'UPDATE beauty_canon SET assist = (SELECT COUNT(*) FROM cos_beauty_canon_assist WHERE beauty_canon_id=beauty_canon.id) WHERE id = :bc_id';
     $model = new self();
     return $model->getWriteConnection()->execute($sql, ['bc_id' => $id]);
 }
Пример #4
0
 /**
  * 设置订单状态
  * @param $userId
  * @param $orderId
  * @param $state
  * @return bool
  */
 public static function SetOrderState($userId, $orderId, $state)
 {
     $sql = 'UPDATE user_order SET order_state = :state WHERE order_id = :id AND user_id = :uid';
     $model = new self();
     return $model->getWriteConnection()->execute($sql, ['state' => $state, 'id' => $orderId, 'uid' => $userId]);
 }
Пример #5
0
 /**
  * 设置密码
  * @param $mobile
  * @param $password
  * @return bool
  */
 public static function SetPassword($mobile, $password)
 {
     $sql = 'UPDATE user_base SET user_password = :pwd WHERE user_account = :mobile';
     $model = new self();
     return $model->getWriteConnection()->execute($sql, ['pwd' => $password, 'mobile' => $mobile]);
 }
Пример #6
0
 /**
  * 设置返回值
  * @param $id
  * @param $response
  */
 public static function setResponse($id, $response)
 {
     $model = new self();
     $sql = 'UPDATE ' . $model->getSource() . ' SET resp_content = :resp, resp_time = NOW() WHERE id = :id';
     $model->getWriteConnection()->execute($sql, ['id' => $id, 'resp' => $response]);
 }