/** * 设置profile信息 * @param type $settingType * @param type $key * @param type $value */ public function setValue($settingType, $key, $value) { $delKeySql = "DELETE FROM mdl_usersetting where SettingKey=:SettingKey and SettingType=:SettingType"; $this->db->createCommand($delKeySql, [":SettingType" => $settingType, ":SettingKey" => $key])->execute(); $data = ["mdl_UserSettingId" => \mysoft\helpers\String::uuid(), "SettingType" => $settingType, "SettingKey" => $key, "SettingValue" => $value, "versionnumber" => '1']; $this->db->createCommand()->insert("mdl_usersetting", $data)->execute(); }
/** * 初始化函数 */ public function actions() { //根据前端cookie backurl跳转 $this->backUrlLocation(); $this->webUrl = Yii::getAlias('@webUrl'); // HTTP根目录 $this->theme = $this->theme ? $this->theme : 'default'; //当前主题皮肤 $this->pub = Yii::getAlias('@webUrl') . '/modules/' . $this->module->id . '/themes/pub'; //注册静态资源依赖关系 \yunke\helpers\Assets::register(); //重复提交表单验证 $user_ticket = I('ticket'); $this->ticket = Yii::$app->session->get('ticket'); //若票据不一致,则返回错误信息 if ($user_ticket && $this->ticket != $user_ticket) { if (Yii::$app->request->isAjax) { $this->ajax_response('0', '请不要重复提交', '100000'); } else { throw E("请不要重复提交", '100000'); } } elseif ($user_ticket) { //一次请求成功后,重置ticket $this->ticket = NULL; } //重置ticket if (empty($this->ticket)) { $this->ticket = String::uuid(); Yii::$app->session->set('ticket', $this->ticket); } //全局赋值 $this->assign('webUrl', $this->webUrl); $this->assign('theme', $this->theme); $this->assign('pub', $this->pub); $this->orgcode = I("__orgcode"); }
/** * 添加短信日志 * @param string $orgcode 租户编码 * @param unknown $logid 日志id * @param unknown $tel 电话号码 * @param unknown $msg 短信内容 * @param unknown $response 短信响应 * @return string */ public static function AddSmsLog($orgcode, $logId, $tel, $msg, $response) { //新增 if (empty($logId)) { $logId = String::uuid(); $logRequest = ['sms_logId' => $logId, 'request' => json_encode(["apiBaseURL" => self::$apiBaseURL, "authURL" => self::$authURL, "clientId" => self::$clientId, "clientSecret" => self::$clientSecret, "tel" => $tel, "msg" => $msg]), 'startdate' => date('Y-m-d H:i:s')]; $res = (new DbProvider($orgcode))->fetch('pub/sms/addSmsLog', [$logId, $logRequest]); return $logId; } else { //更新 $logResponse = ['response' => json_encode($response), 'enddate' => date("Y-m-d H:i:s")]; $res = (new DbProvider($orgcode))->fetch('pub/sms/modifySmsLog', [$logId, $logResponse]); } }