public function check($account = '', $type = '') { $rules['phone'] = Sp_Dictionary::getOtherOption("patternMobile"); $rules['email'] = Sp_Dictionary::getOtherOption("patternEmail"); $msg['phone'] = "电话格式不正确"; $msg['email'] = "邮箱格式不正确"; $return = 1; $filter = array('phone', 'email'); if (false == in_array($type, $filter)) { $return = array("status" => -100, "msg" => "参数错误"); } else { if (FALSE == preg_match($rules[$type], $account)) { $return = array("status" => -101, "msg" => $msg[$type]); } else { $currentTime = time(); $time = $currentTime - 60; $hours = $currentTime - 60 * 60; $where = array($type => $account); $flag = Da_Wrapper::select()->table('sp.huitong.ht_sms_report')->columns('id')->where($where)->where("crttime >= {$time}")->getOne(); if (false != $flag) { $return = array("status" => -102, "msg" => "请一分钟后在试"); } $sendCount = Da_Wrapper::select()->table('sp.huitong.ht_sms_report')->columns('id')->where($where)->where("crttime >= {$hours}")->getTotal(); if (5 <= $sendCount) { $return = array("status" => -103, "msg" => "你已多次获取,为保证账号的安全,防止恶意验证,请1小时后再试"); } } } return $return; }
/** * 获得单行数据 */ public static function getActiveById($id, $user_id = 0) { $db = Da_Wrapper::select()->table(self::DB_TABLE_ACTIVE)->where("id", $id)->where("isdel", 0); if ($user_id > 0) { $db = $db->where('user_id', $user_id); } $data = $db->getRow(); return $data; }
/** * function getUserIfCanEdit * @param int $id * @return boolean */ public static function getUserById($id = 0, $column = '') { if ($id < 1) { return -1; } if (empty($column)) { $data = Da_Wrapper::select()->table(self::DB_TABLE_ADMIN_USER)->where('id', '=', $id)->getRow(); if (!isset($data) || empty($data)) { return -2; } } else { $data = Da_Wrapper::select()->table(self::DB_TABLE_ADMIN_USER)->columns($column)->where('id', '=', $id)->getOne(); } return $data; }
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; }
public static function last($uid, $type) { $ret = Da_Wrapper::select()->table(self::DB_TABLE_LOG)->columns('addtime')->where('user_id', $uid)->where('type', $type)->orderby('id DESC')->getOne(); return $ret; }
protected function _getRow($id, $key = 'id') { $select = Da_Wrapper::select()->table(self::DB_TABLE_USER)->columns('id', $key, 'userid', 'pwd', 'kid', 'mobile', 'email', 'status', 'regtime', 'regip', 'logintime', 'loginip', 'login_nums')->where($key, $id); return $select->getRow(); }
<?php /* * editor by carten */ define('ROOT_PATH', __DIR__ . '/../../../'); include_once ROOT_PATH . 'config/init.php'; $request = Request::current(); $activeId = $request->active_id; if (is_numeric($activeId)) { $where['activeId'] = $activeId; $unSign = Da_Wrapper::select()->table("sp.huitong.ht_apply_data")->where($where)->where("status = 0")->getTotal(); $signed = Da_Wrapper::select()->table("sp.huitong.ht_apply_data")->where($where)->where("status = 1")->getTotal(); $jsonParam = array("code" => "204", "msg" => "查询成功", "signed" => $signed, "unsign" => $unSign); } else { $jsonParam = array("code" => "206", "msg" => "参数错误", "signed" => 0, "unsign" => 0); } header('Content-type: application/json;charset=utf-8'); echo json_encode($jsonParam);
/** * 通过手机获得对应的用户信息 */ public static function getUserByPhone($phone) { $select = Da_Wrapper::select()->table(self::DB_TABLE_USER)->where('mobile', $phone); return $select->getRow(); }
/** * 获取当前参会人的人数 */ public static function getCurrentNum($Id) { return Da_Wrapper::select()->table("sp.huitong.ht_apply_data")->where(array("activeId" => $Id))->getTotal(); }
/* * editor by carten */ define('ROOT_PATH', __DIR__ . '/../../../'); include_once ROOT_PATH . 'config/init.php'; $request = Request::current(); $signNo = $request->signNo; $activeId = $request->active_Id; file_put_contents("/sproot/logs/1111_sign_line.txt", "signNo:" . $signNo . ",activeId:" . $activeId); $patternMobile = Sp_Dictionary::getOtherOption("patternMobile"); if (preg_match($patternMobile, $signNo)) { $where = array("phone" => $signNo, "activeId" => $activeId); } else { $where = array("signId" => $signNo); } $signId = Da_Wrapper::select()->table("sp.huitong.ht_apply_data")->columns('Id,status')->where($where)->getRow(); if (!$signId['Id']) { $jsonParam = array("code" => "204", "msg" => "签到码不存在"); } else { if (1 == $signId['status']) { $jsonParam = array("code" => "205", "msg" => "签到码已使用"); } else { if (-1 == $signId['status']) { $jsonParam = array("code" => "206", "msg" => "签到码无效"); } else { if (0 == $signId['status']) { $model = new Sp_Account_Attendee(); if ($model->signAndDelete(array($signId["Id"]), 1)) { $jsonParam = array("code" => "200", "msg" => "恭喜您,签到成功"); } }
/** * 活动城市联动 * */ public static function getChlidById($id = 0) { $data = Da_Wrapper::select()->table(self::DB_TABLE_CITY)->where('parentid', $id)->orderby('listorder asc')->getAll(); return $data; }
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; } }
/** * 通过签到码获得参会人 */ public static function getAttendeeBySn($signId) { $row = Da_Wrapper::select()->table(self::DB_TABLE)->where("signId", $signId)->getRow(); return $row; }