/** * @新增学生用户 数据入库 */ public function registerUser($data = null, $userip = null) { if ($data['agreement']) { if ($data['user_password'] == $data['user_checkpwd']) { if ($data['user_phone']) { if (is_null($this->onlyPhone($data['user_phone']))) { $data['user_id'] = 0; $data['user_type'] = 1; $data['user_addtime'] = time(); $data['user_lastlogin'] = time(); $data['user_lastip'] = $userip; $data['user_status'] = 1; $model = new User(); $model->attributes = $data; if ($model->validate()) { $model->setAttributes($data); $model->user_password = md5($data['user_password']); if ($model->save(false)) { $user_id = $model->attributes['user_id']; $stu = new Students(); $stu->stu_id = $user_id; $stu->save(); return $this->result(1, '注册成功'); } else { return $this->result(5, '注册失败'); } } else { // 验证失败:$errors 是一个包含错误信息的数组 $errors = $model->errors; print_r($errors); } } else { return $this->result(6, '手机号已存在'); } } else { return $this->result(4, '手机号错误'); } } else { return $this->result(3, '两次输入密码不一致'); } } else { return $this->result(2, '您还没有选择注册协议'); } }
public function getPassword($user_id) { return Students::find()->select('stu_id,stu_money,stu_pwd')->where(['stu_id' => $user_id])->asArray()->one(); }
public function actionConfirms() { $models = new GoodsOrder(); //实例化订单 $students = new Students(); //实例化学生 $request = yii::$app->request->post(); $session = yii::$app->session->get('userinfo'); $user_id = $session['user_id']; $user = $students->getStuDetails($user_id); $Realpay = $request['costTotal'] - $request['money']; /*生成订单*/ $models->order_sn = abs('110' . uniqid(time())); $models->user_id = $user_id; $models->user_name = $user['stu_name']; $models->user_phone = $session['user_phone']; $models->merchant_id = $request['mer_id']; $models->merchant_name = $request['mer_name']; $models->order_amount = $Realpay; $models->order_addtime = time(); $models->order_price = $request['costTotal']; $res = $models->save(); $order_id = Yii::$app->db->getLastInsertID(); $type = 'MER_GOODS'; if ($res) { $this->redirect(['/alipay/index', 'order_id' => $order_id, 'type' => $type]); } else { $this->error('支付失败'); } }
/** * @return string * 获取用户详细信息 */ public function actionUsermessage() { // $data = '<div ><span id="persons" style="font-size: 20px;padding-left: 20px;color: red;">个人详细记录</span><span id="parts" style="font-size: 20px;padding-left: 20px">兼职详细记录</span><span style="font-size: 30px;padding-left:200px;" onclick="CloseDiv(\'MyDiv\',\'fade\')">☒</span></div><table id="person" cellpadding="0" cellspacing="0" style="margin-top: 30px;margin-left: 20px;font-size: 16px;display: block"><tr><td style="width: 120px">昵称</td><td style="width: 800px;padding-left: 20px">呆萌的洒家</td></tr><tr bgcolor="#dafff3"><td style="width: 120px">真实姓名</td><td style="padding-left: 20px">帐篷</td></tr><tr><td style="width: 120px">昵称</td><td style="width: 800px;padding-left: 20px">呆萌的洒家</td></tr><tr bgcolor="#dafff3"><td style="width: 120px">真实姓名</td><td style="padding-left: 20px">帐篷</td></tr><tr><td style="width: 120px">性别</td><td style="width: 800px;padding-left: 20px">男</td></tr><tr bgcolor="#dafff3"><td style="width: 120px">身高</td><td style="padding-left: 20px">180cm</td></tr><tr><td style="width: 120px">学校</td><td style="width: 800px;padding-left: 20px">北京地质大学</td></tr><tr bgcolor="#dafff3"><td style="width: 120px">专业</td><td style="padding-left: 20px">环境与市政工程</td></tr><tr><td style="width: 120px">地址</td><td style="width: 800px;padding-left: 20px">北京海淀区地质大学6号楼1120室</td></tr><tr bgcolor="#dafff3"><td style="width: 120px">技能</td><td style="padding-left: 20px">推广/注册</td></tr><tr><td style="width: 120px">可调工作</td><td style="width: 800px;padding-left: 20px">店员/服务生</td></tr><tr bgcolor="#dafff3"><td style="width: 120px">自我简介</td><td style="padding-left: 20px">本人家传绝技,胸口碎大石。</td></tr><tr><td style="width: 120px">工作经验</td><td style="width: 800px;padding-left: 20px">好多兼职都干过</td></tr><tr bgcolor="#dafff3"><td style="width: 120px">申请理由</td><td style="padding-left: 20px">好多兼职都干过</td></tr></table><table class="date" cellpadding="0" cellspacing="0" id="part" style="display: none"><thead style="background: #E5E5E4;"><tr><th>职位</th><th>商家名称 </th><th>评分</th><th>评论内容</th></tr></thead><tbody id="parttimedate"><tr><td>APP推广员</td><td>北京优势梦想有限公司</td><td>5</td><td>不错,工作认真</td></tr></tbody></table>'; // echo $data;die; $user_id = Yii::$app->request->get("user_id"); $job_id = Yii::$app->request->get("job_id"); /* 获取申请兼职理由 */ $list = new FinPartList(); $reasons = $list->getreasons($user_id, $job_id); /* 获取用户详细信息 */ $student = new Students(); $usermessage = $student->getStudent($user_id); //var_dump($usermessage);die; /* 获取商家对用户兼职的详细记录 */ $part = new Comment(); $partrecord = $part->getshopcomment($user_id, $job_id, 10); //var_dump($partrecord);die; /* 判断用户是否存在 */ if (!empty($usermessage)) { $data = '<div id="MyDiv" class="white_content"><div ><span id="persons" style="font-size: 20px;padding-left: 20px;color: red;">个人详细记录</span><span id="parts" style="font-size: 20px;padding-left: 20px">兼职详细记录</span><span style="font-size: 30px;padding-left:200px;" onclick="CloseDiv(\'MyDiv\',\'fade\')"></span></div><table id="person" cellpadding="0" cellspacing="0" style="margin-top: 30px;margin-left: 20px;font-size: 16px;display: block"><tr><td style="width: 120px">昵称</td><td style="width: 800px;padding-left: 20px">' . $student['stu_nickname'] . '</td></tr><tr bgcolor="#dafff3"><td style="width: 120px">真实姓名</td><td style="padding-left: 20px">' . $student['stu_name'] . '</td></tr><tr><td style="width: 120px">性别</td><td style="width: 800px;padding-left: 20px">'; /* 输出性别 */ if ($student['stu_sex'] == 0) { $data .= "保密"; } elseif ($student['stu_sex'] == 1) { $data .= "男"; } else { $data .= "女"; } $data .= '</td></tr><tr bgcolor="#dafff3"><td style="width: 120px">身高</td><td style="padding-left: 20px">' . $student['stu_height'] . 'cm</td></tr><tr><td style="width: 120px">学校</td><td style="width: 800px;padding-left: 20px">' . $student['stu_school'] . '</td></tr><tr bgcolor="#dafff3"><td style="width: 120px">专业</td><td style="padding-left: 20px">' . $student['stu_professional'] . '</td></tr><tr><td style="width: 120px">地址</td><td style="width: 800px;padding-left: 20px">' . $student['stu_professional'] . '</td></tr><tr bgcolor="#dafff3"><td style="width: 120px">技能</td><td style="padding-left: 20px">' . $student['skills_name'] . '</td></tr><tr bgcolor="#dafff3"><td style="width: 120px">自我简介</td><td style="padding-left: 20px">' . $student['stu_introduction'] . '</td></tr><tr><td style="width: 120px">工作经验</td><td style="width: 800px;padding-left: 20px">' . $student['stu_experience'] . '</td></tr><tr bgcolor="#dafff3"><td style="width: 120px">申请理由</td><td style="padding-left: 20px">' . $reasons['part_reasons'] . '</td></tr></table><table class="date" cellpadding="0" cellspacing="0" id="part" style="display: none"><thead style="background: #E5E5E4;"><tr><th>职位</th><th>商家名称 </th><th>评分</th><th>评论内容</th></tr></thead><tbody id="parttimedate">'; /* 循环用户兼职的详细信息 */ foreach ($partrecord as $k => $v) { $data .= '<tr><td>' . $v['user_name'] . '</td><td>' . $v['comment_level'] . '</td><td>' . $v['comment_content'] . '</td></tr>'; } $data .= '</tbody></table></div>'; echo $data; } }