/** * 发起反馈 */ public function create() { if (IS_POST) { $data['seller_id'] = $this->mid; $data['module'] = MODULE_NAME; $data['content'] = str_rp(trim($_POST['content'])); $data['contact'] = str_rp(trim($_POST['contact'])); $data['addtime'] = NOW_TIME; $data['has_reply'] = 0; //图片上传 if (!empty($_FILES['pic']['size'])) { $img = 'feedback_' . re_md5(NOW_TIME . nonce_str()); $param = array('savePath' => MODULE_NAME . '/feedback/', 'subName' => '', 'files' => $_FILES['pic'], 'saveName' => $img, 'saveExt' => ''); $up_return = upload_one($param); if ($up_return == 'error') { $this->error('图片上传失败'); exit; } else { $data['pic'] = $up_return; } } $res = $this->model->add($data); if ($res) { $this->success('谢谢您的意见及建议.', U('detail', array('id' => $res))); } else { $this->error('非常抱歉,您的意见及建议没有提交成功.'); } } elseif (IS_GET) { $this->h3_title = '发起反馈'; $this->display(); } }
public function member_edit() { if (IS_POST) { $more_address = serialize($_POST['more_address']); $old_pwd = M('Member')->where(array('uid' => isLogin(), 'status' => 1))->getField('password'); if (empty($_POST['password'])) { $this->error('密码不能为空'); } if ($old_pwd == $_POST['password']) { $password = $_POST['password']; } else { $password = re_md5($_POST['password']); } $data = array('password' => $password, 'long_name' => str_rp(trim($_POST['long_name'])), 'nickname' => str_rp(trim($_POST['nickname'])), 'contact_phone' => str_rp(trim($_POST['contact_phone'])), 'contact_name' => str_rp(trim($_POST['contact_name'])), 'school_phone' => str_rp(trim($_POST['school_phone'])), 'school_address' => str_rp(trim($_POST['school_address'])), 'more_address' => serialize($_POST['more_address']), 'qq' => str_rp(trim($_POST['qq'])), 'email' => str_rp(trim($_POST['email'])), 'fax' => str_rp(trim($_POST['fax'])), 'school_desc' => str_replace('\'', ''', $_POST['school_desc'])); unset($lastpath); unset($up_return); unset($filename); if (!empty($_FILES['avatar']['size'])) { $lastpath = M('Member')->where(array('uid' => isLogin()))->getField('avatar'); $filename = 'avatar_' . nonce_str(8, 1, 1, 1); $param = array('savePath' => 'member/', 'subName' => isLogin(), 'exts' => '', 'files' => $_FILES['avatar'], 'saveName' => $filename, 'saveExt' => ''); $up_return = upload_one($param); if ($up_return) { @unlink(BasePath . '/Uploads/' . $lastpath); $data['avatar'] = $up_return; } else { $this->error('上传头像失败'); } } $res = M('Member')->where(array('uid' => isLogin()))->save($data); if ($res) { $this->success('操作成功', U('member')); } else { $this->error('操作失败'); } } else { $info = M('Member')->where(array('uid' => isLogin()))->find(); $info['more_address'] = unserialize($info['more_address']); $info['numAdd'] = count($info['more_address']); $this->vo = $info; $this->display(); } }
public function sendSMS() { if (IS_AJAX) { if (session('code_time') - 60 > NOW_TIME) { echo '请' . NOW_TIME - session('code_time') . '后再进行操作.'; die; } session('smscode', null); session('mobile', null); session('codetype', null); session('code_time', null); $mobile = trim($_POST['mobile']); $type = trim($_POST['type']); if (is_numeric($mobile)) { $check_phone = M('Member')->where(array('mobile' => $mobile, 'member_id' => $this->mid))->count(); if (!$check_phone) { echo '非法操作'; die; } $code = nonce_str(4, 0, 0); session('smscode', strtolower($code)); session('mobile', $mobile); session('codetype', $type); session('code_time', NOW_TIME); $content = '您好,您的短信验证码是' . $code; $res = customSendSMS($mobile, $content); if ($res) { echo '短信发送成功,请查收.'; } else { echo '短信发送失败.'; } } else { echo '不是有效的手机号码'; } } else { echo '非法操作'; } }
public function report() { $this->reportMod = D('Report'); if (IS_POST) { $data['rp_class_id'] = intval($_POST['rp_class_id']); $data['order_sn'] = str_rp(trimall($_POST['order_sn'])); $data['content'] = str_rp(trim($_POST['content'])); $data['addtime'] = NOW_TIME; $where['order_sn'] = $data['order_sn']; $where['member_id'] = $this->mid; $data['seller_id'] = M('Order')->where($where)->getField('member_id'); $data['member_id'] = $this->mid; $data['from_to'] = 1; $data['handle_status'] = 0; if ($data['member_id']) { $map['order_sn'] = $data['order_sn']; $map['from_to'] = 1; $count = $this->reportMod->where($map)->count(); if ($count) { $this->error('您已经提交过相关申诉,请耐心等待.'); die; } //图片上传 if (!empty($_FILES['pic']['size'])) { $arc_img = NOW_TIME . '_' . nonce_str(8, 1, 1, 1); $param = array('savePath' => 'report/' . $data['order_sn'] . '/', 'subName' => '', 'files' => $_FILES['pic'], 'saveName' => $arc_img, 'saveExt' => ''); $up_return = upload_one($param); if ($up_return == 'error') { $this->error('图片上传失败'); exit; } else { $data['report_pic'] = $up_return; } } $res = $this->reportMod->add($data); if ($res) { $detail['report_id'] = $res; $detail['content'] = '会员对卖家发起申诉'; $detail['addtime'] = NOW_TIME; M('ReportDetail')->add($detail); $this->success('申诉成功.', U('progress', array('sn' => $data['order_sn']))); } else { $this->error('抱歉,申诉申请失败.请联系客服.'); } } else { $this->error('抱歉,没有相关订单信息.'); } } elseif (IS_GET) { $this->classModel = M('ReportClass'); $rp_class = $this->classModel->where(array('rp_class_belong' => 2))->order('rp_class_sort desc')->select(); $this->assign('rp_class', $rp_class); $this->h3_title = '发起新的申诉'; $this->assign('h3_text', '申诉任务'); $this->display(); } }
public function sendSMS() { if (IS_AJAX) { if (session('code_time') - 60 > NOW_TIME) { echo '请' . NOW_TIME - session('code_time') . '后再进行操作.'; die; } session('smscode', null); session('mobile', null); session('codetype', null); session('code_time', null); $mobile = trim($_POST['mobile']); $type = trim($_POST['type']); $email = I('post.email', '', 'email'); $class = trim($_POST['s_class']); if ($class == 'mobile') { if (is_numeric($mobile)) { $check_phone = $this->model->where(array('mobile' => $mobile))->count(); if ($check_phone && $type == 'register') { echo '该手机已注册'; die; } if ($check_phone == 0 && $type == 'forgot') { echo '该手机号码不存在'; die; } $code = nonce_str(4, 0, 0); session('smscode', strtolower($code)); session('mobile', $mobile); session('codetype', $type); session('code_time', NOW_TIME); $content = '您好,您的短信验证码是' . $code; $res = customSendSMS($mobile, $content); if ($res) { echo '短信发送成功,请查收.'; } else { echo '短信发送失败.'; } } else { echo '不是有效的手机号码'; } } elseif ($class == 'email') { if (!empty($email)) { $check_email = $this->model->where(array('email' => $email))->count(); if ($check_email && $type == 'register') { echo '该邮箱已注册'; die; } if ($check_email == 0 && $type == 'forgot') { echo '该邮箱不存在'; die; } $code = nonce_str(4, 0, 0); session('smscode', strtolower($code)); session('email', $email); session('codetype', $type); session('code_time', NOW_TIME); $content = '您好,您的验证码是' . $code; $res = sendEmail($email, '欢迎注册佐西卡会员', $content); if ($res) { echo '邮件发送成功,请查收.'; } else { echo '邮件发送失败.'; } } else { echo '邮箱不能为空'; } } } else { echo '非法操作'; } }
public function sendSMS() { if (IS_AJAX) { session(null); $mobile = trim($_POST['mobile']); $type = trim($_POST['type']); if (is_numeric($mobile)) { $check_phone = $this->model->where(array('mobile' => $mobile))->count(); if ($check_phone && $type == 'register') { echo '该手机已注册'; die; } if ($check_phone == 0 && $type == 'forgot') { echo '该手机号码不存在'; die; } $code = nonce_str(4); session('smscode', $code); session('mobile', $mobile); session('codetype', $type); session('code_time', NOW_TIME); $content = '您好,您的短信验证码是' . $code; $res = sendSMS($mobile, $content); if ($res) { echo $code; } else { echo 404; } } else { echo 500; } } else { echo 200; } }