Пример #1
0
 public static function updatebankpayment($row, $pid, $bid)
 {
     if (is_array($row)) {
         $res = Da_Wrapper::update()->table(self::DB_TABLE_BANK_PAYMENT)->data($row)->where('bank_id', $bid)->where('pay_id', $pid)->execute();
     }
     return $res;
 }
Пример #2
0
 /**
  * 根据主键删除活动
  * 
  * @param string|array $key 主键
  */
 public static function delByPrimarykey($id, $user_id = 0)
 {
     $db = Da_Wrapper::update()->table(self::DB_TABLE_LETTER)->data(array('status' => -1))->where('id', $id);
     if ($user_id > 0) {
         $db = $db->where('user_id', $user_id);
     }
     $data = $db->execute();
     return $data;
 }
Пример #3
0
 /**
  * 通过id修改对应的活动
  * @param int $id 活动id
  * @param array $row 修改的数据
  * @param int $user_id 用户id
  * 
  */
 public static function updateById($id, $row, $user_id = 0)
 {
     $db = Da_Wrapper::update()->table(self::DB_TABLE_ACTIVE)->data($row)->where('id', $id);
     if ($user_id > 0) {
         $db = $db->where('user_id', $user_id);
     }
     $ret = $db->execute();
     return $ret;
 }
Пример #4
0
 public function getSignIdCode($data)
 {
     $where = array('id' => $data["id"]);
     $signId = Da_Wrapper::select()->table("sp.huitong.ht_apply_data")->columns('signId')->where($where)->getOne();
     if ($signId) {
         $signCode = $signId;
     } else {
         $time = date("YmdHis");
         $activeId = substr($data["activeId"], -2);
         $activeId = strlen($activeId) > 1 ? $activeId : "0{$activeId}";
         $phone = substr($data["phone"], -3);
         $signIdEle = array(substr($time, 3, 4), substr($phone, 0, 2), $activeId, substr($phone, -1), substr($time, 7, 1), substr($time, 8));
         $signCode = implode("", $signIdEle);
         Da_Wrapper::update()->table("sp.huitong.ht_apply_data")->data(array("signId" => $signCode))->where($where)->execute();
     }
     return $signCode;
 }
 /**
  * function description
  *
  * @param
  * @return void
  */
 public static function store($id = 0, $row = array())
 {
     if (count($row) < 1) {
         return false;
     }
     //set password
     if (!empty($row['password'])) {
         $current_user = Sp_Admin_Account::current();
         $row['password'] = $current_user->hashPassword($row['username'], $row['password']);
     } else {
         unset($row['password']);
     }
     if (!$id) {
         // create
         $ret = Da_Wrapper::insert()->table(self::DB_TABLE_ADMIN_USER)->data($row)->execute();
     } else {
         $ret = Da_Wrapper::update()->table(self::DB_TABLE_ADMIN_USER)->data($row)->where('id', $id)->execute();
         if ($ret > 0) {
             $ret = $id;
         }
     }
     return $ret;
 }
Пример #6
0
 /**
  * 修改用户密码
  *
  * @param int $userid 用户 id
  * @param string $pwd 密码
  */
 public static function updatePassword($userid, $pwd)
 {
     $data = array('pwd' => $pwd);
     $rs = Da_Wrapper::update()->table(self::DB_TABLE_USER)->data($data)->where('id', $userid)->execute();
     return $rs;
 }
Пример #7
0
 /**
  * @param $username 账号
  * @param $pwd      密码
  */
 public static function RePwd($username, $pwd)
 {
     $field_name = 'mobile';
     if (preg_match($patternMobile, $username)) {
         $field_name = 'mobile';
     } elseif (preg_match($patternEmail, $username)) {
         $field_name = 'email';
     }
     $row = array();
     $row['kid'] = time();
     $row['pwd'] = self::encrypt($pwd, $row['kid']);
     $ret = Da_Wrapper::update()->table(self::DB_TABLE_USER)->data($row)->where($field_name, $username)->execute();
     return $ret;
 }
Пример #8
0
 public static function authCode($account = '', $code = '', $type = '')
 {
     $return = self::checkCode($account, $code, $type);
     if (1 !== $return) {
         return $return;
     }
     $update = array('phone' => array('update' => array('mobile_status' => 1), 'where' => array('mobile' => $account)), 'email' => array('update' => array('email_status' => 1), 'where' => array('email' => $account)));
     $data['code'] = $code;
     $data['sms_id'] = $type;
     $data[$type] = $account;
     $time = time() - 15 * 60;
     if ($userid = Da_Wrapper::select()->table(self::DB_TABLE_MSM)->columns('id')->where($data)->where("crttime >= {$time}")->getOne()) {
         $reUpdate = Da_Wrapper::update()->table("sp.huitong.ht_users")->data($update[$type]['update'])->where($update[$type]['where'])->execute();
         $cache = Cache::factory();
         $key = 'user_' . $userid;
         $cache->delete($key);
         return $reUpdate ? 1 : false;
     } else {
         return false;
     }
 }
Пример #9
0
 /**
  * 设置审核成功
  */
 public static function success($id)
 {
     $ret = Da_Wrapper::update()->table(self::DB_TABLE)->data(array("checkStatus" => 1))->where("id", $id)->execute();
     return $ret;
 }