コード例 #1
0
ファイル: goods.php プロジェクト: zhendeguoke1008/shop
 /**
  * @brief 商品模型添加/修改
  */
 public function model_update()
 {
     // 获取POST数据
     $attribute = IReq::get("attr");
     $spec = IReq::get("spec");
     $model_name = IReq::get("model_name");
     $model_id = IReq::get("model_id");
     //初始化Model类对象
     $modelObj = new Model();
     //校验数据
     if (!IValidate::required($model_name)) {
         //处理post数据,渲染到前台
         $result = $modelObj->postArrayChange($attribute, $spec);
         $this->data = array('id' => $model_id, 'name' => $model_name, 'model_attr' => $result['model_attr'], 'model_spec' => $result['model_spec']);
         $this->setRenderData($this->data);
         $this->redirect('model_edit', false);
         Util::showMessage('模型名称不能为空!');
         exit;
     }
     //更新模型数据
     $result = $modelObj->model_update($model_id, $model_name, $attribute, $spec);
     if ($result) {
         $this->redirect('model_list');
     } else {
         //处理post数据,渲染到前台
         $result = $modelObj->postArrayChange($attribute, $spec);
         $this->data = array('id' => $model_id, 'name' => $model_name, 'model_attr' => $result['model_attr'], 'model_spec' => $result['model_spec']);
         $this->setRenderData($this->data);
         $this->redirect('model_edit', false);
     }
 }
コード例 #2
0
ファイル: model.php プロジェクト: zhendeguoke1008/shop
 /**
  * @brief 商品属性添加/修改
  * @param array $attribute 表字段 数组格式,如Array ([name] 		=> Array ( [0] => '' )
  *													[show_type] => Array ( [0] => '' )
  *													[value] 	=> Array ( [0] => '' )
  *													[is_seach] 	=> Array ( [0] => 1 ))
  * @param int $model_id 模型编号
  */
 public function _attribute_update($attribute, $model_id)
 {
     //初始化attribute商品模型属性表类对象
     $attributeObj = new IModel('attribute');
     $len = count($attribute['name']);
     $ids = "";
     for ($i = 0; $i < $len; $i++) {
         if (IValidate::required($attribute['name'][$i]) && IValidate::required($attribute['value'][$i])) {
             $options = str_replace(',', ',', $attribute['value'][$i]);
             $type = isset($attribute['is_search'][$i]) ? $attribute['is_search'][$i] : 0;
             //设置商品模型扩展属性 字段赋值
             $filedData = array("model_id" => intval($model_id), "type" => IFilter::act($attribute['show_type'][$i]), "name" => IFilter::act($attribute['name'][$i]), "value" => rtrim(IFilter::act($options), ','), "search" => IFilter::act($type));
             $attributeObj->setData($filedData);
             $id = intval($attribute['id'][$i]);
             if ($id) {
                 //更新商品模型扩展属性
                 $attributeObj->update("id = " . $id);
             } else {
                 //新增商品模型扩展属性
                 $id = $attributeObj->add();
             }
             $ids .= $id . ',';
         }
     }
     if ($ids) {
         $ids = trim($ids, ',');
         //删除商品模型扩展属性
         $where = "model_id = {$model_id}  and id not in (" . $ids . ") ";
         $attributeObj->del($where);
     }
 }
コード例 #3
0
ファイル: hsms.php プロジェクト: herrify/iwebshop
 /**
  * @brief 发送短信
  * @param string $mobile 手机号
  * @param string $content 短信内容
  * @param int $delay 延迟设置
  * @return success or fail
  */
 public static function send($mobile, $content, $delay = 1)
 {
     if (self::$smsInstance == null) {
         $platform = self::getPlatForm();
         switch ($platform) {
             case "zhutong":
                 $classFile = IWeb::$app->getBasePath() . 'plugins/hsms/zhutong.php';
                 require $classFile;
                 self::$smsInstance = new zhutong();
                 break;
             default:
                 $classFile = IWeb::$app->getBasePath() . 'plugins/hsms/haiyan.php';
                 require $classFile;
                 self::$smsInstance = new haiyan();
         }
     }
     if (IValidate::mobi($mobile) && $content) {
         $ip = IClient::getIp();
         if ($ip) {
             if ($delay == 1) {
                 $mobileKey = md5($ip);
                 $sendTime = ISession::get($mobileKey);
                 if ($sendTime && time() - $sendTime < 60) {
                     return false;
                 }
                 ISession::set($mobileKey, time());
             }
             return self::$smsInstance->send($mobile, $content);
         }
     }
     return false;
 }
コード例 #4
0
ファイル: memberclass.php プロジェクト: snamper/xiaoshuhaochi
 function findpwd($uname)
 {
     if (!IValidate::email($uname)) {
         $this->error = '邮箱格式错误';
         return false;
     }
     $memberinfo = $this->mysql->select_one("select * from " . Mysite::$app->config['tablepre'] . "member where email='" . $uname . "' ");
     if (empty($memberinfo)) {
         $this->error = '获取邮箱帐号失败';
         return false;
     }
     $title = '找回' . Mysite::$app->config['sitename'] . '帐号密码';
     $sign = $this->mymd5($memberinfo['password'], $memberinfo['username']);
     $emaildata['findpwdurl'] = IUrl::creatUrl("member/resetpwd/uid/" . $memberinfo['uid'] . "/username/" . urlencode($memberinfo['username']) . "/sign/" . $sign);
     $default_tpl = new config('tplset.php', hopedir);
     $tpllist = $default_tpl->getInfo();
     if (!isset($tpllist['emailfindtpl']) || empty($tpllist['emailfindtpl'])) {
         $this->error = '管理员未设置邮箱发送信息,请联系客服';
         return false;
     }
     $emaildata['username'] = $memberinfo['username'];
     $emaildata['email'] = $memberinfo['email'];
     $emaildata['sitename'] = Mysite::$app->config['sitename'];
     $emaildata['siteurl'] = Mysite::$app->config['siteurl'];
     $smtp = new ISmtp(Mysite::$app->config['smpt'], 25, Mysite::$app->config['emailname'], Mysite::$app->config['emailpwd'], false);
     $content = Mysite::$app->statichtml($tpllist['emailfindtpl'], $emaildata);
     $info = $smtp->send($memberinfo['email'], Mysite::$app->config['emailname'], $title, $content, "", "HTML", "", "");
     return true;
 }
コード例 #5
0
ファイル: method.php プロジェクト: snamper/xiaoshuhaochi
 function saveopen()
 {
     if (empty($this->member['uid'])) {
         $link = IUrl::creatUrl('member/index');
         $this->message('想开店请先注册为普通会员', $link);
     }
     $maphone = IFilter::act(IReq::get('maphone'));
     $shopname = IFilter::act(IReq::get('shopname'));
     $address = IFilter::act(IReq::get('address'));
     $shoptype = IFilter::act(IReq::get('shoptype'));
     if (!IValidate::phone($maphone)) {
         $this->message('联系电话格式错误');
     }
     if (!IValidate::len($shopname, 3, 30)) {
         $this->message('店铺名长度大于3小于30');
     }
     if (!IValidate::len($address, 6, 50)) {
         $this->message('店铺地址长度大于6小于50');
     }
     $userinfo = $this->mysql->select_one("select * from " . Mysite::$app->config['tablepre'] . "shop where uid='" . $this->member['uid'] . "' ");
     if (!empty($userinfo)) {
         $this->message('您已绑定店铺不可操作');
     }
     $userinfo = $this->mysql->select_one("select * from " . Mysite::$app->config['tablepre'] . "shop where maphone='" . $maphone . "' ");
     if (!empty($userinfo)) {
         $this->message('联系人电话已存在');
     }
     $userinfo = $this->mysql->select_one("select * from " . Mysite::$app->config['tablepre'] . "shop where shopname='" . $shopname . "' ");
     if (!empty($userinfo)) {
         $this->message('店铺名称已重复');
     }
     $arr['shopname'] = $shopname;
     $arr['maphone'] = $maphone;
     $arr['uid'] = $this->member['uid'];
     $arr['address'] = $address;
     $arr['addtime'] = time();
     $arr['is_open'] = '0';
     $arr['shoptype'] = $shoptype;
     $nowday = 24 * 60 * 60 * 365;
     $data['endtime'] = time() + $nowday;
     $this->mysql->insert(Mysite::$app->config['tablepre'] . 'shop', $arr);
     $this->success('操作成功');
 }
コード例 #6
0
ファイル: simple -6-29.php プロジェクト: yongge666/sunupedu
 /**
  * @brief 发送验证邮箱邮件
  */
 public function send_check_mail()
 {
     $email = IReq::get('email');
     if (IValidate::email($email) == false) {
         IError::show(403, '邮件格式错误');
     }
     $userDB = new IModel('user');
     $userRow = $userDB->getObj('email = "' . $email . '"');
     $code = base64_encode($userRow['email'] . "|" . $userRow['id']);
     $url = IUrl::getHost() . IUrl::creatUrl("/simple/check_mail/code/{$code}");
     $content = mailTemplate::checkMail(array("{url}" => $url));
     //发送邮件
     $smtp = new SendMail();
     $result = $smtp->send($email, "用户注册邮箱验证", $content);
     if ($result === false) {
         IError::show(403, "发信失败,请重试!或者联系管理员查看邮件服务是否开启");
     }
     $message = "您的邮箱验证邮件已发送到{$email}!请到您的邮箱中去激活";
     $this->redirect('/site/success?message=' . urlencode($message) . '&email=' . $email);
 }
コード例 #7
0
ファイル: method.php プロジェクト: snamper/xiaoshuhaochi
 function editaddress()
 {
     $this->checkmemberlogin();
     $what = trim(IFilter::act(IReq::get('what')));
     $addressid = intval(IReq::get('addressid'));
     if (empty($addressid)) {
         $this->message('编辑地址获取失败');
     }
     if ($what == 'default') {
         $arr['default'] = 0;
         $this->mysql->update(Mysite::$app->config['tablepre'] . 'address', $arr, "userid='" . $this->member['uid'] . "'");
         $arr['default'] = 1;
         $this->mysql->update(Mysite::$app->config['tablepre'] . 'address', $arr, "id='" . $addressid . "' and userid='" . $this->member['uid'] . "' ");
         $this->success('操作成功');
     } elseif ($what == 'addr') {
         $arr['address'] = IFilter::act(IReq::get('controlname'));
         if (!IValidate::len($arr['address'], 5, 50)) {
             $this->message('录入地址长度不能少于5个');
         }
         $this->mysql->update(Mysite::$app->config['tablepre'] . 'address', $arr, "id='" . $addressid . "' and userid='" . $this->member['uid'] . "' ");
         $this->success('操作成功');
     } elseif ($what == 'phone') {
         $arr['phone'] = IFilter::act(IReq::get('controlname'));
         if (!IValidate::phone($arr['phone'])) {
             $this->message('录入的联系电话不是手机或者座机正确');
         }
         $this->mysql->update(Mysite::$app->config['tablepre'] . 'address', $arr, "id='" . $addressid . "' and userid='" . $this->member['uid'] . "' ");
         $this->success('操作成功');
     } elseif ($what == 'bak_phone') {
         $arr['otherphone'] = IFilter::act(IReq::get('controlname'));
         if (!IValidate::phone($arr['otherphone'])) {
             $this->message('录入的备用电话不是手机或者座机正确');
         }
         $this->mysql->update(Mysite::$app->config['tablepre'] . 'address', $arr, "id='" . $addressid . "' and userid='" . $this->member['uid'] . "' ");
         $this->success('操作成功');
     } elseif ($what == 'recieve_name') {
         $arr['contactname'] = IFilter::act(IReq::get('controlname'));
         if (!IValidate::len($arr['contactname'], 2, 6)) {
             $this->message('联系人名长度不能小于2个大于6个');
         }
         $this->mysql->update(Mysite::$app->config['tablepre'] . 'address', $arr, "id='" . $addressid . "' and userid='" . $this->member['uid'] . "' ");
         $this->success('操作成功');
     } else {
         $this->message('未定义的操作');
     }
 }
コード例 #8
0
ファイル: adminmethod.php プロジェクト: snamper/xiaoshuhaochi
 function starttask()
 {
     $taskid = IReq::get('taskid');
     $taskinfo = $this->mysql->select_one("select * from " . Mysite::$app->config['tablepre'] . "task where id='" . $taskid . "'  ");
     if (empty($taskinfo)) {
         echo '任务不存在';
         exit;
     }
     if ($taskinfo['status'] > 1) {
         echo '任务执行完毕,请关闭窗口';
         exit;
     }
     $data = array('taskmiaoshu' => '');
     //执行任务
     if ($taskinfo['tasktype'] == 1) {
         $emailids = '';
         //邮箱ID集
         $newdata = array();
         //任务处理数据
         $data['taskmiaoshu'] .= '邮件群发任务';
         if ($taskinfo['taskusertype'] == 1) {
             //	echo '根据用户表筛选查询'.$taskinfo['tasklimit'];//tasklimit
             //构造默认查询
             $where = ' where uid > ' . $taskinfo['start_id'] . '  ' . $taskinfo['tasklimit'];
             //start_id;//起点UID
             $memberlist = $this->mysql->getarr("select * from " . Mysite::$app->config['tablepre'] . "member " . $where . " order by uid asc  limit 0, 10");
             $startid = $taskinfo['start_id'];
             if (count($memberlist) > 9) {
                 foreach ($memberlist as $key => $value) {
                     if (IValidate::email($value['email'])) {
                         $emailids .= empty($emailids) ? $value['email'] : ',' . $value['email'];
                     }
                     $startid = $value['uid'];
                 }
             }
             if (count($memberlist) < 10) {
                 //更新任务执行完毕
                 $newdata['status'] = 2;
                 $data['taskmiaoshu'] .= ',执行完毕';
             } else {
                 //
                 $newdata['status'] = 1;
                 $newdata['start_id'] = $startid;
                 //更新下一页
                 $data['taskmiaoshu'] .= ',从用户表uid为' . $taskinfo['start_id'] . '执行到uid为' . $startid;
             }
             //更新任务
         } else {
             $tasklimit = $taskinfo['tasklimit'];
             $checklist = explode(',', $tasklimit);
             foreach ($checklist as $key => $value) {
                 if (IValidate::email($value)) {
                     $emailids .= empty($emailids) ? $value : ',' . $value;
                 }
             }
             $newdata['status'] = 2;
             //更新任务
             $data['taskmiaoshu'] .= ',根据指定邮箱地址发送邮件完成';
         }
         //更新任务
         $this->mysql->update(Mysite::$app->config['tablepre'] . 'task', $newdata, "id='" . $taskid . "'");
         if (!empty($emailids)) {
             $smtp = new ISmtp(Mysite::$app->config['smpt'], 25, Mysite::$app->config['emailname'], Mysite::$app->config['emailpwd'], false);
             //$content = iconv('utf-8','gb2312',$content);
             $info = $smtp->send($emailids, Mysite::$app->config['emailname'], $taskinfo['taskname'], $taskinfo['content'], "", "HTML", "", "");
         }
         $data['taskdata'] = $newdata;
         $data['showcontent'] = $emailids;
     } else {
         $emailids = '';
         //邮箱ID集
         $newdata = array();
         //任务处理数据
         $data['taskmiaoshu'] .= '短信群发任务';
         if ($taskinfo['taskusertype'] == 1) {
             //	echo '根据用户表筛选查询'.$taskinfo['tasklimit'];//tasklimit
             //构造默认查询
             $where = ' where uid > ' . $taskinfo['start_id'] . '  ' . $taskinfo['tasklimit'];
             //start_id;//起点UID
             $memberlist = $this->mysql->getarr("select * from " . Mysite::$app->config['tablepre'] . "member " . $where . " order by uid asc  limit 0, 10");
             $startid = $taskinfo['start_id'];
             if (count($memberlist) > 9) {
                 foreach ($memberlist as $key => $value) {
                     if (IValidate::suremobi($value['phone'])) {
                         $emailids .= empty($emailids) ? $value['phone'] : ',' . $value['phone'];
                     }
                     $startid = $value['uid'];
                 }
             }
             if (count($memberlist) < 10) {
                 //更新任务执行完毕
                 $newdata['status'] = 2;
                 $data['taskmiaoshu'] .= ',执行完毕';
             } else {
                 //
                 $newdata['status'] = 1;
                 $newdata['start_id'] = $startid;
                 //更新下一页
                 $data['taskmiaoshu'] .= ',从用户表uid为' . $taskinfo['start_id'] . '执行到uid为' . $startid;
             }
             //更新任务
         } else {
             $tasklimit = $taskinfo['tasklimit'];
             $checklist = explode(',', $tasklimit);
             foreach ($checklist as $key => $value) {
                 if (IValidate::suremobi($value)) {
                     $emailids .= empty($emailids) ? $value : ',' . $value;
                 }
             }
             $newdata['status'] = 2;
             //更新任务
             $data['taskmiaoshu'] .= ',根据指定手机号发送短信完成';
         }
         //更新任务
         $data['showcontent'] = $emailids;
         if (!empty($emailids)) {
             $sendmobile = new mobile();
             /*
             $checklogin = $sendmobile->login(); 
             if($checklogin == 'ok')
             {
             */
             $emailids = explode(',', $emailids);
             $chekcinfo = $sendmobile->sendsms($emailids, $taskinfo['content']);
             if ($chekcinfo == 'ok') {
                 //发送成功
                 //更新任务
                 $this->mysql->update(Mysite::$app->config['tablepre'] . 'task', $newdata, "id='" . $taskid . "'");
             } else {
                 $data['taskmiaoshu'] .= ',短信发送失败,错误代码:' . $chekcinfo;
             }
             /*
             	      	  $sendmobile->endsend();
             	      }else{
             	      	  $data['taskmiaoshu'] .= ',短信发送失败,错误代码:'.$checklogin;
             	      }	*/
         }
         $data['taskdata'] = $newdata;
     }
     Mysite::$app->setdata($data);
 }
コード例 #9
0
ファイル: method.php プロジェクト: snamper/xiaoshuhaochi
 function saveGustAddress()
 {
     $username = trim(IFilter::act(IReq::get('username')));
     $mobile = intval(IFilter::act(IReq::get('mobile')));
     $addressdet = trim(IFilter::act(IReq::get('addressdet')));
     if (!IValidate::suremobi($mobile)) {
         echo json_encode(array('success' => 'error', 'msg' => '请输入正确的手机号'));
         exit;
     }
     $value = serialize(array("username" => $username, "mobile" => $mobile, "addressdet" => $addressdet));
     $res = setcookie("gustAddress", $value, time() + 31536000);
     if ($res) {
         echo json_encode(array('success' => 'yes', 'msg' => '保存成功'));
         exit;
     }
 }
コード例 #10
0
ファイル: method.php プロジェクト: snamper/xiaoshuhaochi
 public function makeorder()
 {
     $subtype = intval(IReq::get("subtype"));
     $info['shopid'] = intval(IReq::get("shopid"));
     $info['remark'] = IFilter::act(IReq::get("content"));
     $info['paytype'] = IFilter::act(IReq::get("paytype"));
     $info['username'] = IFilter::act(IReq::get("contactname"));
     $info['mobile'] = IFilter::act(IReq::get("phone"));
     $info['addressdet'] = IFilter::act(IReq::get("addressdet"));
     $info['senddate'] = IFilter::act(IReq::get("senddate"));
     $info['minit'] = IFilter::act(IReq::get("orderTime"));
     $info['juanid'] = intval(IReq::get("juanid"));
     $info['ordertype'] = 1;
     $peopleNum = IFilter::act(IReq::get("personcount"));
     $info['othercontent'] = empty($peopleNum) ? "" : serialize(array("人数" => $peopleNum));
     $info['userid'] = !isset($this->member['score']) ? "0" : $this->member['uid'];
     if (Mysite::$app->config['allowedguestbuy'] != 1 && $info['userid'] == 0) {
         $this->message("member_nologin");
     }
     $shopinfo = $this->mysql->select_one("select * from " . Mysite::$app->config['tablepre'] . "shopfast as a left join " . Mysite::$app->config['tablepre'] . "shop as b  on a.shopid = b.id where a.shopid = '" . $info['shopid'] . "'    ");
     if (empty($shopinfo)) {
         $this->message("店铺不存在");
     }
     $checksend = Mysite::$app->config['ordercheckphone'];
     if ($checksend == 1 && empty($this->member['uid'])) {
         $checkphone = $this->mysql->select_one("select * from " . Mysite::$app->config['tablepre'] . "mobile where phone ='" . $info['mobile'] . "'   order by addtime desc limit 0,50");
         if (empty($checkphone)) {
             $this->message("member_emailyan");
         }
         if (empty($checkphone['is_send'])) {
             $mycode = IFilter::act(IReq::get("phonecode"));
             if ($mycode == $checkphone['code']) {
                 $this->mysql->update(Mysite::$app->config['tablepre'] . "mobile", array("is_send" => 1), "phone='" . $info['mobile'] . "'");
             } else {
                 $this->message("member_emailyan");
             }
         }
     }
     if (empty($info['username'])) {
         $this->message("emptycontact");
     }
     if (!IValidate::suremobi($info['mobile'])) {
         $this->message("errphone");
     }
     $info['ipaddress'] = "";
     $ip_l = new iplocation();
     $ipaddress = $ip_l->getaddress($ip_l->getIP());
     if (isset($ipaddress['area1'])) {
         $info['ipaddress'] = $ipaddress['ip'] . mb_convert_encoding($ipaddress['area1'], "UTF-8", "GB2312");
     }
     $info['cattype'] = 0;
     $senddate = $info['senddate'];
     $minit = $info['minit'];
     $nowpost = strtotime($senddate . " " . $minit . ":00");
     $settime = time() - 600;
     if ($nowpost < $settime) {
         $this->message("提交配送时间和服务器时间相差超过10分钟下单失败");
     }
     $temp = strtotime($minit . ":00");
     $is_orderbefore = $shopinfo['is_orderbefore'] == 0 ? 0 : $shopinfo['befortime'];
     $tempinfo = $this->checkshopopentime($is_orderbefore, $nowpost, $shopinfo['starttime']);
     if (!$tempinfo) {
         $this->message("配送时间不在有效配送时间范围");
     }
     if ($shopinfo['is_open'] != 1) {
         $this->message("店铺暂停营业");
     }
     $info['paytype'] = $info['paytype'] == 1 ? 1 : 0;
     $info['areaids'] = "";
     $info['shopinfo'] = $shopinfo;
     if ($subtype == 1) {
         $info['allcost'] = 0;
         $info['bagcost'] = 0;
         $info['allcount'] = 0;
         $info['goodslist'] = array();
     } else {
         if (empty($info['shopid'])) {
             $this->message("shop_noexit");
         }
         $Cart = new smCart();
         $Cart->cartName = 'platesmcart';
         $carinfo = $Cart->getMyCart();
         if (!isset($carinfo['list'][$info['shopid']]['data'])) {
             $this->message("shop_emptycart");
         }
         $info['allcost'] = $carinfo['list'][$info['shopid']]['sum'];
         $info['goodslist'] = $carinfo['list'][$info['shopid']]['data'];
         $info['bagcost'] = 0;
         $info['allcount'] = 0;
     }
     $info['shopps'] = 0;
     $info['pstype'] = 0;
     $info['cattype'] = 1;
     $info['is_goshop'] = 1;
     $info['subtype'] = $subtype;
     $info['sendtime'] = $nowpost;
     $orderclass = new orderclass($this->mysql);
     $orderclass->orderyuding($info);
     $orderid = $orderclass->getorder();
     if ($info['userid'] == 0) {
         ICookie::set("orderid", $orderid, 86400);
     }
     if ($subtype == 2) {
         $Cart->delshop($info['shopid']);
     }
     $this->success($orderid);
     exit;
 }
コード例 #11
0
ファイル: method.php プロジェクト: snamper/xiaoshuhaochi
 function setphone()
 {
     $checksend = Mysite::$app->config['ordercheckphone'];
     if ($checksend == 1) {
         if (!empty($this->member['uid'])) {
             echo 'removesend()';
             exit;
         }
         $phone = IFilter::act(IReq::get('phone'));
         if (IValidate::suremobi($phone)) {
             $checkphone = $this->mysql->select_one("select * from " . Mysite::$app->config['tablepre'] . "mobile where phone ='" . $phone . "'   order by addtime desc limit 0,50");
             if (!empty($checkphone)) {
                 if ($checkphone['is_send'] == 1) {
                     echo 'removesend()';
                     exit;
                 }
                 $bijiaotime = time() - 180;
                 if ($checkphone['addtime'] > $bijiaotime) {
                     //验证码还有效
                     $backtime = 180 - (time() - $checkphone['addtime']);
                     ICookie::set('phonecode', $checkphone['code'], $backtime);
                     echo 'showsend(\'' . $phone . '\',' . $backtime . ')';
                     exit;
                 }
             }
             //重新发送验证码
             $data['code'] = mt_rand(10000, 99999);
             $data['phone'] = $phone;
             $data['addtime'] = time();
             $data['is_send'] = 0;
             ICookie::set('phonecode', $data['code'], 180);
             /*调用发送*/
             /* usercodetpl*/
             $default_tpl = new config('tplset.php', hopedir);
             $tpllist = $default_tpl->getInfo();
             if (!isset($tpllist['usercodetpl']) || empty($tpllist['usercodetpl'])) {
                 // logwrite('短信发送商家模板加载失败');
                 echo 'alert(\'发送失败,请联系管理员设置模板\')';
                 exit;
             } else {
                 $sendmobile = new mobile();
                 $tempdata['code'] = $data['code'];
                 $tempdata['sitename'] = Mysite::$app->config['sitename'];
                 $contents = Mysite::$app->statichtml($tpllist['usercodetpl'], $tempdata);
                 if (Mysite::$app->config['smstype'] == 2) {
                     //139邮箱转发短信
                     //使用sms10086cn发送/
                     $APIServer = 'http://www.sms-10086.cn/Service.asmx/sendsms?';
                     $weblink = $APIServer . 'zh=' . trim(Mysite::$app->config['sms86ac']) . '&mm=' . trim(Mysite::$app->config['sms86pd']) . '&hm=' . $phone . '&nr=' . urlencode($contents) . '&dxlbid=27';
                     $contentcccc = file_get_contents($weblink);
                     logwrite('验证短信发送:' . $contentcccc);
                 } else {
                     //使用sms10086cn发送/
                     $phoneids = array();
                     $phoneids[] = $phone;
                     $chekcinfo = $sendmobile->sendsms($phoneids, $contents);
                     logwrite('验证短信发送:' . $chekcinfo);
                 }
             }
             $this->mysql->insert(Mysite::$app->config['tablepre'] . 'mobile', $data);
             echo 'showsend(\'' . $phone . '\',180)';
             exit;
         } else {
             echo 'alert(\'不是手机号\')';
             exit;
         }
     } else {
         echo '';
         exit;
     }
 }
コード例 #12
0
ファイル: method.php プロジェクト: snamper/xiaoshuhaochi
 function makeorder()
 {
     $backinfo = $this->checkappMem();
     if (empty($backinfo['uid'])) {
         $this->message('nologin');
     }
     $info['shopid'] = intval(IReq::get('shopid'));
     //店铺ID
     $info['remark'] = IFilter::act(IReq::get('remark'));
     //备注
     $info['paytype'] = 'outpay';
     //支付方式IFilter::act(IReq::get('paytype'));//支付方式
     $info['dikou'] = intval(IReq::get('dikou'));
     //抵扣金额
     $info['username'] = IFilter::act(IReq::get('username'));
     $info['mobile'] = IFilter::act(IReq::get('mobile'));
     $info['addressdet'] = IFilter::act(IReq::get('addressdet'));
     $info['senddate'] = date('Y-m-d', time());
     // IFilter::act(IReq::get('senddate'));
     $info['minit'] = IFilter::act(IReq::get('minit'));
     $info['juanid'] = intval(IReq::get('juanid'));
     //优惠劵ID
     $info['ordertype'] = 5;
     //订单类型
     $peopleNum = IFilter::act(IReq::get('peopleNum'));
     $info['othercontent'] = '';
     //empty($peopleNum)?'':serialize(array('人数'=>$peopleNum));
     if (empty($info['shopid'])) {
         $this->message('店铺ID错误');
     }
     $Cart = new smCart();
     $carinfo = $Cart->getMyCart();
     if (!isset($carinfo['list'][$info['shopid']]['data'])) {
         $this->message('对应店铺购物车商品为空');
     }
     if ($carinfo['list'][$info['shopid']]['shopinfo']['shoptype'] == 1) {
         $shopinfo = $this->mysql->select_one("select * from " . Mysite::$app->config['tablepre'] . "shopmarket as a left join " . Mysite::$app->config['tablepre'] . "shop as b  on a.shopid = b.id where a.shopid = '" . $info['shopid'] . "'    ");
     } else {
         $shopinfo = $this->mysql->select_one("select * from " . Mysite::$app->config['tablepre'] . "shopfast as a left join " . Mysite::$app->config['tablepre'] . "shop as b  on a.shopid = b.id where a.shopid = '" . $info['shopid'] . "'    ");
     }
     if (empty($shopinfo)) {
         $this->message('店铺获取失败');
     }
     //	 $checkps = 	 $this->pscost($shopinfo,$carinfo['list'][$info['shopid']]['count']);
     //	 if($checkps['canps'] != 1) $this->message('该店铺不在配送范围内');
     $info['cattype'] = 0;
     //
     if (empty($info['username'])) {
         $this->message('联系人不能为空');
     }
     if (!IValidate::suremobi($info['mobile'])) {
         $this->message('请输入正确的手机号');
     }
     if (empty($info['addressdet'])) {
         $this->message('详细地址为空');
     }
     $info['userid'] = !isset($backinfo['score']) ? '0' : $backinfo['uid'];
     //判断库存
     $senddate = $info['senddate'];
     $minit = $info['minit'];
     $nowpost = strtotime($senddate . ' ' . $minit . ':00');
     $day = strtotime(date('Y-m-d', $nowpost));
     $goods_id_list = [];
     foreach ($carinfo['list'][$info['shopid']]['data'] as $key => $value) {
         $goods_id_list[] = $value['id'];
     }
     $goods_ids = implode(',', $goods_id_list);
     $stock_info_list = $this->mysql->getarr("SELECT goods_id,stock FROM " . Mysite::$app->config['tablepre'] . "daystock WHERE goods_id in ({$goods_ids}) AND day={$day}");
     $stock_list = [];
     foreach ($stock_info_list as $key => $value) {
         $stock_list[$value['goods_id']] = $value['stock'];
     }
     foreach ($carinfo['list'][$info['shopid']]['data'] as $key => $value) {
         if ($value['daycount'] - $stock_list[$value['id']] - $value['count'] < 0) {
             $this->message($valeu['name'] . '库存不足');
             exit;
         }
     }
     $ip_l = new iplocation();
     $ipaddress = $ip_l->getaddress($ip_l->getIP());
     if (isset($ipaddress["area1"])) {
         $info['ipaddress'] = $ipaddress['ip'] . mb_convert_encoding($ipaddress["area1"], 'UTF-8', 'GB2312');
         //('GB2312','ansi',);
     }
     //area1 二级地址名称	area2 三级地址名称	area3
     $data['areaids'] = '';
     /*
     	  $checksend = Mysite::$app->config['ordercheckphone'];
         if($checksend == 1){
         	  if(empty($this->member['uid'])){
         	  	  $checkphone = $this->mysql->select_one("select * from ".Mysite::$app->config['tablepre']."mobile where phone ='".$info['mobile']."'   order by addtime desc limit 0,50");
         	  	  if(empty($checkphone)) $this->message('短信验证码不能为空');
         	  	  if(empty($checkphone['is_send'])){
         	  	    $mycode = IFilter::act(IReq::get('phonecode'));
         	  	    if($mycode == $checkphone['code']){
         	  	       $this->mysql->update(Mysite::$app->config['tablepre'].'mobile',array('is_send'=>1),"phone='".$info['mobile']."'");
         	  	    }else{
         	  	       $this->message('验证码不一致');
         	  	    }
         	  	  }
         	  }
         }*/
     $data['shopcost'] = 0;
     //:店铺商品总价
     $data['shopps'] = 0;
     //店铺配送费
     $data['bagcost'] = 0;
     //:打包费
     //获取店铺商品总价  获取超市商品总价
     $data['shopcost'] = $carinfo['list'][$info['shopid']]['sum'];
     $data['shopps'] = 0;
     //$checkps['pscost'];
     $data['bagcost'] = $carinfo['list'][$info['shopid']]['bagcost'];
     //支付方式检测
     $data['paytype'] = $info['paytype'];
     $paytype = $info['paytype'];
     if ($paytype != 'outpay') {
         if ($paytype == 'open_acout') {
             if (Mysite::$app->config['open_acout'] != 1 || $userid == 0) {
                 $data['paytype'] = 'outpay';
             }
         } else {
             $paylist = $this->mysql->counts("select * from " . Mysite::$app->config['tablepre'] . "paylist where loginname='" . $paytype . "'  order by id desc  ");
             if ($paylist < 1) {
                 $data['paytype'] = 'outpay';
             }
         }
     }
     //判断促销
     $data['cxids'] = '';
     $data['cxcost'] = 0;
     $zpin = array();
     $cattype = $info['cattype'];
     if ($data['shopcost'] > 0) {
         $sellrule = new sellrule();
         $cxtypeid = $cattype + 1;
         $sellrule->setdata($info['shopid'], $data['shopcost'], $shopinfo['shoptype']);
         $ruleinfo = $sellrule->getdata();
         $data['cxcost'] = $ruleinfo['downcost'];
         $data['cxids'] = $ruleinfo['cxids'];
         $zpin = $ruleinfo['zid'];
         //赠品
         $data['shopps'] = $ruleinfo['nops'] == true ? 0 : $data['shopps'];
     }
     //判断优惠劵
     $allcost = $data['shopcost'];
     $data['yhjcost'] = 0;
     $data['yhjids'] = '';
     $juanid = $info['juanid'];
     $userid = $info['userid'];
     if ($juanid > 0 && $userid > 0) {
         $juaninfo = $this->mysql->select_one("select *  from " . Mysite::$app->config['tablepre'] . "juan  where id= '" . $juanid . "' and uid='" . $userid . "'  and status = 1 and endtime > " . time() . " ");
         if (!empty($juaninfo)) {
             if ($allcost >= $juaninfo['limitcost']) {
                 $data['yhjcost'] = $juaninfo['cost'];
                 $juandata['status'] = 2;
                 $juandata['usetime'] = time();
                 $this->mysql->update(Mysite::$app->config['tablepre'] . 'juan', $juandata, "id='" . $juanid . "'");
                 $data['yhjids'] = $juanid;
             }
         }
     }
     //积分抵扣
     $allcost = $allcost - $data['cxcost'] - $data['yhjcost'];
     $data['scoredown'] = 0;
     $dikou = $info['dikou'];
     if (!empty($userid) && $dikou > 0 && Mysite::$app->config['scoretocost'] > 0 && $allcost > $dikou) {
         $checkuser = $this->mysql->select_one("select * from " . Mysite::$app->config['tablepre'] . "member where uid='" . $userid . "'  ");
         if (is_array($checkuser)) {
             $checkscore = $dikou * intval(Mysite::$app->config['scoretocost']);
             if ($checkuser['score'] >= $checkscore) {
                 $data['scoredown'] = $checkscore;
                 $this->mysql->update(Mysite::$app->config['tablepre'] . 'member', '`score`=`score`-' . $checkscore, "uid ='" . $userid . "' ");
             }
         }
     }
     $dikou = $data['scoredown'] > 0 ? $dikou : 0;
     $allcost = $allcost - $dikou;
     $data['allcost'] = $allcost + $data['shopps'] + $data['bagcost'];
     //订单应收费用
     $data['shopuid'] = 0;
     // 店铺UID
     $data['shopid'] = 0;
     //店铺ID
     $data['shopname'] = '商城';
     //店铺名称
     $data['shopphone'] = Mysite::$app->config['marketphone'];
     //店铺电话
     $data['shopaddress'] = '';
     // 店铺地址
     $data['pstype'] = 0;
     //$checkps['pstype'] ;
     $data['shoptype'] = $shopinfo['shoptype'];
     //检测店铺
     //$senddate = $info['senddate'];
     //$minit = $info['minit'];
     //$nowpost = strtotime($senddate.' '.$minit.':00');
     $settime = time() - 10 * 60;
     if ($settime > $nowpost) {
         $this->message('提交配送时间和服务器时间相差超过10分钟下单失败');
     }
     $temp = strtotime($minit . ':00');
     $is_orderbefore = $shopinfo['is_orderbefore'] == 0 ? 0 : $shopinfo['befortime'];
     $tempinfo = $this->checkshopopentime($is_orderbefore, $nowpost, $shopinfo['starttime']);
     if (!$tempinfo) {
         $this->message('配送时间不在有效配送时间范围');
     }
     $checkcost = $allcost + $data['yhjcost'];
     if ($shopinfo['is_open'] != 1) {
         $this->message('店铺暂停营业');
     }
     if ($shopinfo['limitcost'] > $checkcost) {
         $this->message('商品总价低于最小起送价' . $shopinfo['limitcost']);
     }
     $data['shopuid'] = $shopinfo['uid'];
     // 店铺UID
     $data['shopid'] = $shopinfo['id'];
     //店铺ID
     $data['shopname'] = $shopinfo['shopname'];
     //店铺名称
     $data['shopphone'] = $shopinfo['phone'];
     //店铺电话
     $data['shopaddress'] = $shopinfo['address'];
     // 店铺地址
     $data['buyeraddress'] = $info['addressdet'];
     $data['ordertype'] = $info['ordertype'];
     //来源方式;
     $data['buyeruid'] = $userid;
     // 购买用户ID,0未注册用户
     $data['buyername'] = $info['username'];
     //购买热名称
     $data['buyerphone'] = $info['mobile'];
     // 联系电话
     $panduan = Mysite::$app->config['man_ispass'];
     $data['status'] = $panduan == 1 ? '0' : 1;
     $data['paystatus'] = 0;
     // 支付状态1已支付
     $data['content'] = $info['remark'];
     // 订单备注
     //  daycode 当天订单序号
     $data['ipaddress'] = $info['ipaddress'];
     $data['is_ping'] = 0;
     // 是否评价字段 1已评完 0未评
     $data['addtime'] = time();
     $data['posttime'] = $nowpost;
     //: 配送时间
     $data['othertext'] = $info['othercontent'];
     //其他说明
     //  :审核时间
     $data['passtime'] = time();
     if ($data['status'] == 1) {
         $data['passtime'] == 0;
     }
     $data['buycode'] = substr(md5(time()), 9, 6);
     $data['dno'] = time() . rand(1000, 9999);
     $minitime = strtotime(date('Y-m-d', time()));
     $tj = $this->mysql->select_one("select count(id) as shuliang from " . Mysite::$app->config['tablepre'] . "order where shopid='" . $info['shopid'] . "' and addtime > " . $minitime . " limit 0,1000");
     $data['daycode'] = $tj['shuliang'] + 1;
     $this->mysql->insert(Mysite::$app->config['tablepre'] . 'order', $data);
     //写主订单
     $orderid = $this->mysql->insertid();
     $this->orderid = $orderid;
     foreach ($carinfo['list'][$info['shopid']]['data'] as $key => $value) {
         $cmd['order_id'] = $orderid;
         $cmd['goodsid'] = $value['id'];
         $cmd['goodsname'] = $value['name'];
         $cmd['goodscost'] = $value['cost'];
         $cmd['goodscount'] = $value['count'];
         $cmd['shopid'] = $value['shopid'];
         $cmd['status'] = 0;
         $cmd['is_send'] = 0;
         $this->mysql->insert(Mysite::$app->config['tablepre'] . 'orderdet', $cmd);
         //减库存pinkky
         $daystock = $this->mysql->select_one("SELECT * FROM " . Mysite::$app->config['tablepre'] . "daystock WHERE goods_id=" . $value['id'] . " and day=" . $day);
         if ($daystock) {
             $this->mysql->update(Mysite::$app->config['tablepre'] . 'daystock', '`stock`=`stock`+1', "id=" . $daystock['id']);
         } else {
             $stockdata['goods_id'] = $value['id'];
             $stockdata['day'] = $day;
             $stockdata['stock'] = 1;
             $this->mysql->insert(Mysite::$app->config['tablepre'] . 'daystock', $stockdata);
         }
         //$this->mysql->update(Mysite::$app->config['tablepre'].'goods','`count`=`count`-'.$cmd['goodscount'].' ,`sellcount`=`sellcount`+'.$cmd['goodscount'],"id='".$cmd['goodsid']."'");
         $this->mysql->update(Mysite::$app->config['tablepre'] . 'goods', '`sellcount`=`sellcount`+' . $cmd['goodscount'], "id='" . $cmd['goodsid'] . "'");
     }
     if (is_array($zpin)) {
         foreach ($zpin as $key => $value) {
             $datadet['order_id'] = $orderid;
             $datadet['goodsid'] = $key;
             $datadet['goodsname'] = $value['presenttitle'];
             $datadet['goodscost'] = 0;
             $datadet['goodscount'] = 1;
             $datadet['shopid'] = $shopinfo['id'];
             $datadet['status'] = 0;
             $datadet['is_send'] = 1;
             //更新促销规则中 此赠品的数量
             $this->mysql->insert(Mysite::$app->config['tablepre'] . 'orderdet', $datadet);
             $this->mysql->update(Mysite::$app->config['tablepre'] . 'rule', '`controlcontent`=`controlcontent`-1', "id='" . $key . "'");
         }
     }
     $checkbuyer = Mysite::$app->config['allowedsendbuyer'];
     if (Mysite::$app->config['man_ispass'] != 1) {
         $orderCLs = new orderclass($this->mysql);
         $orderCLs->sendmess($orderid);
     }
     if ($userid == 0) {
         ICookie::set('orderid', $orderid, 86400);
     } else {
         //保持地址数据
         $checkinfo = $this->mysql->select_one("select * from " . Mysite::$app->config['tablepre'] . "address where userid='" . $userid . "'  ");
         if (empty($checkinfo)) {
             $addata['userid'] = $backinfo['uid'];
             $addata['username'] = $backinfo['username'];
             $addata['address'] = $data['buyeraddress'];
             $addata['phone'] = $data['buyerphone'];
             $addata['contactname'] = $data['buyername'];
             $addata['default'] = 1;
             $this->mysql->insert(Mysite::$app->config['tablepre'] . 'address', $addata);
         }
     }
     $Cart->delshop($info['shopid']);
     $this->success($orderid);
 }
コード例 #13
0
ファイル: simple.php プロジェクト: Wen1750686723/utao
 public function bind_nexists_user()
 {
     $username = IFilter::act(IReq::get('username'));
     $email = IFilter::act(IReq::get('email'));
     $oauth_id = IFilter::act(ISession::get('oauth_id'));
     $oauth_userInfo = IFilter::act(ISession::get('oauth_userInfo'));
     /*注册信息校验*/
     if (IValidate::email($email) == false) {
         $message = '邮箱格式不正确';
     } else {
         if (!Util::is_username($username)) {
             $message = '用户名必须是由2-20个字符,可以为字数,数字下划线和中文';
         } else {
             $userObj = new IModel('user');
             $where = 'email = "' . $email . '" or username = "******" or username = "******"';
             $userRow = $userObj->getObj($where);
             if (!empty($userRow)) {
                 if ($email == $userRow['email']) {
                     $message = '此邮箱已经被注册过,请重新更换';
                 } else {
                     $message = "此用户名已经被注册过,请重新更换";
                 }
             } else {
                 $userData = array('email' => $email, 'username' => $username, 'password' => md5(ITime::getDateTime()));
                 $userObj->setData($userData);
                 $user_id = $userObj->add();
                 $memberObj = new IModel('member');
                 $memberData = array('user_id' => $user_id, 'true_name' => $oauth_userInfo['name'], 'last_login' => ITime::getDateTime(), 'sex' => isset($oauth_userInfo['sex']) ? $oauth_userInfo['sex'] : 1, 'time' => ITime::getDateTime());
                 $memberObj->setData($memberData);
                 $memberObj->add();
                 $oauthUserObj = new IModel('oauth_user');
                 //插入关系表
                 $oauthUserData = array('oauth_user_id' => $oauth_userInfo['id'], 'oauth_id' => $oauth_id, 'user_id' => $user_id, 'datetime' => ITime::getDateTime());
                 $oauthUserObj->setData($oauthUserData);
                 $oauthUserObj->add();
                 $userRow = $userObj->getObj('id = ' . $user_id);
                 $this->loginAfter($userRow);
                 //自定义跳转页面
                 $callback = ISafe::get('callback');
                 $this->redirect('/simple/success_info/?callback=' . $callback);
             }
         }
     }
     if ($message != '') {
         $this->message = $message;
         $this->redirect('bind_user', false);
     }
 }
コード例 #14
0
ファイル: method.php プロジェクト: snamper/xiaoshuhaochi
 function loginbycode()
 {
     $uname = IFilter::act(IReq::get('uname'));
     $code = IFilter::act(IReq::get('code'));
     $link = IUrl::creatUrl('member/login');
     $logincode = intval(IFilter::act(IReq::get('logincode')));
     if (!empty($logincode)) {
         ICookie::set('logincode', $logincode, 86400 * 365);
     }
     if (empty($uname)) {
         $this->message('手机不能为空', $link);
         exit;
     }
     if (empty($code)) {
         $this->message('验证码不能为空', $link);
         exit;
     }
     $logintype = IFilter::act(IReq::get('logintype'));
     if (!IValidate::suremobi($uname)) {
         $this->message('联系手机格式错误');
     }
     //$checkcode =    ICookie::get('regphonecode');
     $res = $this->mobilecodecheck($uname, $code);
     if ($res['success'] == 'no') {
         $this->message($res['msg']);
     }
     //if($code != $checkcode) $this->message('手机验证码错误');
     if (!$this->memberCls->login($uname, $pwd = "", $code = true)) {
         $this->message($this->memberCls->ero(), $link);
     }
     $link = IUrl::creatUrl('member/base');
     $this->success('', $link);
 }
コード例 #15
0
ファイル: method.php プロジェクト: snamper/xiaoshuhaochi
 function guestorderlist()
 {
     $this->setstatus();
     $phone = IFilter::act(IReq::get('phone'));
     $link = IUrl::creatUrl('order/guestorder');
     $Captcha = IFilter::act(IReq::get('Captcha'));
     $type = IFilter::act(IReq::get('type'));
     if (Mysite::$app->config['allowedcode'] == 1) {
         if ($Captcha != ICookie::get('Captcha')) {
             $this->message('验证码错误', $link);
         }
     }
     if (!IValidate::suremobi($phone)) {
         $this->message('请录入正确的手机号码');
     }
     $data['phone'] = $phone;
     $data['Captcha'] = $Captcha;
     $data['where'] = ' buyerphone = \'' . $phone . '\'';
     $data['where'] .= empty($type) ? ' and shoptype=0' : ' and shoptype=1';
     $data['type'] = $type;
     Mysite::$app->setdata($data);
 }
コード例 #16
0
ファイル: orderclass.php プロジェクト: snamper/xiaoshuhaochi
    function sendmess($orderid)
    {
        $smtp = new ISmtp(Mysite::$app->config['smpt'], 25, Mysite::$app->config['emailname'], Mysite::$app->config['emailpwd'], false);
        $sendmobile = new mobile();
        $wx_s = new wx_s();
        $orderinfo = $this->mysql->select_one("select *  from " . Mysite::$app->config['tablepre'] . "order  where id= '" . $orderid . "'   ");
        $orderdet = $this->mysql->getarr("select *  from " . Mysite::$app->config['tablepre'] . "orderdet  where order_id= '" . $orderid . "'   ");
        $shopinfo = $this->mysql->select_one("select *  from " . Mysite::$app->config['tablepre'] . "shop  where id= '" . $orderinfo['shopid'] . "'   ");
        $tempdata = array('orderinfo' => $orderinfo, 'orderdet' => $orderdet, 'sitename' => Mysite::$app->config['sitename']);
        $contents = '';
        $checknotice = isset($shopinfo['noticetype']) ? explode(',', $shopinfo['noticetype']) : array();
        $contents = '';
        $appcheck = $this->mysql->select_one("select *  from " . Mysite::$app->config['tablepre'] . "applogin where uid = '" . $orderinfo['shopuid'] . "'   ");
        if (!empty($appcheck)) {
            /* $appCls = new appclass();
               $backinfo = $appCls->sendmsg($appcheck['userid'],$appcheck['channelid'],Mysite::$app->config['sitename'].'订单提醒','您有新的订单,单号:'.$orderinfo['dno'],$messagetype=1);
               logwrite('APP发送:'.$backinfo);*/
        }
        if (in_array(1, $checknotice)) {
            if (Mysite::$app->config['allowedsendshop'] == 1) {
                if (IValidate::suremobi($orderinfo['shopphone'])) {
                    $default_tpl = new config('tplset.php', hopedir);
                    $tpllist = $default_tpl->getInfo();
                    if (!isset($tpllist['shopphonetpl']) || empty($tpllist['shopphonetpl'])) {
                        // logwrite('短信发送商家模板加载失败');
                    } else {
                        $contents = Mysite::$app->statichtml($tpllist['shopphonetpl'], $tempdata);
                        if (Mysite::$app->config['smstype'] == 2) {
                            //139邮箱转发短信
                            //使用sms10086cn发送/
                            $APIServer = 'http://www.sms-10086.cn/Service.asmx/sendsms?';
                            $weblink = $APIServer . 'zh=' . trim(Mysite::$app->config['sms86ac']) . '&mm=' . trim(Mysite::$app->config['sms86pd']) . '&hm=' . $orderinfo['shopphone'] . '&nr=' . urlencode($contents) . '&dxlbid=27';
                            $contentcccc = file_get_contents($weblink);
                            logwrite('短信sms10086cn发送结果:' . $contentcccc);
                        } else {
                            //使用sms10086cn发送/
                            $phoneids = array();
                            $phoneids[] = $orderinfo['shopphone'];
                            $chekcinfo = $sendmobile->sendsms($phoneids, $contents);
                            logwrite('亿美短信接口发送结果:' . $chekcinfo);
                        }
                    }
                } else {
                    logwrite('短信发送商家' . $shopinfo['shopname'] . '联系电话错误');
                }
            }
        }
        if (in_array(3, $checknotice)) {
            $wechat = $this->mysql->select_one("select * from " . Mysite::$app->config['tablepre'] . "shop_wechat where shopid=" . $orderinfo['shopid']);
            $wx_s = array();
            if (!empty($wechat)) {
                $wx_s = new wx_s($wechat['token'], $wechat['appid'], $wechat['secret'], $orderinfo['shopid']);
            }
            if (!empty($orderinfo['shopuid']) && !empty($wechat)) {
                $wechat = $this->mysql->select_one("select * from " . Mysite::$app->config['tablepre'] . "shop_wechat where shopid=" . $orderinfo['shopid']);
                //if (!empty($wechat)) {
                //$wx_s = new wx_s($wechat['token'], $wechat['appid'], $wechat['secret'],$orderinfo['shopid']);
                //找到要发送的商户微信openid
                $openid_list = $this->mysql->getarr("select openid from " . Mysite::$app->config['tablepre'] . "shop_wxuser where shopid=" . $orderinfo['shopid'] . " and is_merchant=1");
                $payarrr = array('outpay' => '到付', 'open_acout' => '余额支付');
                $orderpastatus = $orderinfo['paystatus'] == 1 ? '已支付' : '未支付';
                $orderpaytype = isset($payarrr[$orderinfo['paytype']]) ? $payarrr[$orderinfo['paytype']] : '在线支付';
                $tempdata = array('orderinfo' => $orderinfo, 'orderdet' => $orderdet, 'sitename' => Mysite::$app->config['sitename']);
                $temp_content = $orderinfo['buyername'] . '在' . Mysite::$app->config['sitename'] . '下单成功' . '\\n';
                $temp_content .= '下单时间:' . date('m-d H:i', $orderinfo['addtime']) . '\\n';
                $temp_content .= '配送时间:' . date('m-d H:i', $orderinfo['posttime']) . '\\n';
                $temp_content .= '支付方式' . $orderpaytype . ',' . $orderpastatus . ' ' . '\\n';
                $temp_content .= '收货人:' . $orderinfo['buyername'] . '\\n';
                $temp_content .= '地址:' . $orderinfo['buyeraddress'] . '\\n';
                $temp_content .= '联系电话:' . $orderinfo['buyerphone'] . '\\n';
                $temp_content .= '单号:' . $orderinfo['dno'] . '\\n';
                $temp_content .= '总价:' . $orderinfo['allcost'] . '元,配送费:' . $orderinfo['shopps'] . '元\\n';
                $temp_content .= '备注:' . $orderinfo['content'] . '\\n';
                foreach ($orderdet as $km => $vc) {
                    $temp_content .= $vc['goodsname'] . '(' . $vc['goodscount'] . '份)\\n';
                }
                if (!empty($openid_list)) {
                    if (!empty($temp_content)) {
                        foreach ($openid_list as $key => $value) {
                            if ($wx_s->sendmsg($temp_content, $value['openid'])) {
                            } else {
                                logwrite('微信客服发送错误:' . $wx_s->err());
                            }
                        }
                    }
                }
                //}
                //$wxshop = $this->mysql->select_one("select *  from ".Mysite::$app->config['tablepre']."wxuser  where uid= '".$orderinfo['shopuid']."'   ");
                /*if(!empty($wxshop)){
                
                                       $payarrr = array('outpay'=>'到付','open_acout'=>'余额支付');
                                       $orderpastatus = $orderinfo['paystatus'] == 1?'已支付':'未支付';
                                       $orderpaytype = isset($payarrr[$orderinfo['paytype']])?$payarrr[$orderinfo['paytype']]:'在线支付';
                                       $tempdata = array('orderinfo'=>$orderinfo,'orderdet'=>$orderdet,'sitename'=>Mysite::$app->config['sitename']);
                                       $temp_content = $orderinfo['buyername'].'在'.Mysite::$app->config['sitename'].'下单成功'.'\n';
                                       $temp_content .='下单时间:'.date('m-d H:i',$orderinfo['addtime']).'\n';
                                       $temp_content .='配送时间:'.date('m-d H:i',$orderinfo['posttime']).'\n';
                                       $temp_content .='支付方式'.$orderpaytype.','.$orderpastatus.' '.'\n';
                                       $temp_content .='收货人:'.$orderinfo['buyername'].'\n';
                                       $temp_content .='地址:'.$orderinfo['buyeraddress'].'\n';
                                       $temp_content .='联系电话:'.$orderinfo['buyerphone'].'\n';
                                       $temp_content .='单号:'.$orderinfo['dno'].'\n';
                                       $temp_content .='总价:'.$orderinfo['allcost'].'元,配送费:'.$orderinfo['shopps'].'元\n';
                                       $temp_content .='备注:'.$orderinfo['content'].'\n';
                                       foreach($orderdet as $km=>$vc){
                                         $temp_content .=$vc['goodsname'].'('.$vc['goodscount'].'份)\n';
                                       }
                                       //增加超连接
                                       $time = time();
                                     $tempstr = md5(Mysite::$app->config['wxtoken'].$time);
                                     $tempstr = substr($tempstr,3,15);
                                     $dolink = Mysite::$app->config['siteurl'].'/index.php?controller=wxsite&action=shopshoworder&id='.$orderinfo['id'];
                                     $backinfo = '';
                                     if(!empty($dolink)){
                                                $templink = $dolink;
                                             for($i=0;$i<strlen($templink);$i++){
                                               $backinfo .= ord($templink[$i]).',';
                                         }
                                   }
                
                                       $linkstr =  Mysite::$app->config['siteurl'].'/index.php?controller=wxsite&action=index&openid='.$wxshop['openid'].'&actime='.$time.'&sign='.$tempstr.'&backinfo='.$backinfo;
                                       $temp_content .= '<a href=\''.trim($linkstr).'\'>查看详情</a>';
                
                                       if(!empty($temp_content)){
                                          $wx_s = new wx_s($wechat['token'], $wechat['appid'], $wechat['secret'],$orderinfo['shopid']);
                                          if($wx_s->sendmsg($temp_content,$wxshop['openid'])){
                
                                          }else{
                                             logwrite('微信客服发送错误:'.$wx_s->err());
                                          }
                
                                       }
                                   }*/
            }
            if (!empty($orderinfo['buyeruid']) && !empty($wechat)) {
                //2015-06-25查不到$shopid把$shopid改成$shopinfo['id']
                $wxbuyer = $this->mysql->select_one("select *  from " . Mysite::$app->config['tablepre'] . "shop_wxuser where shopid='" . $shopinfo['id'] . "' and uid= '" . $orderinfo['buyeruid'] . "'   ");
                if (!empty($wxbuyer)) {
                    if (empty($contents)) {
                        $default_tpl = new config('tplset.php', hopedir);
                        $tpllist = $default_tpl->getInfo();
                        if (!isset($tpllist['shopphonetpl']) || empty($tpllist['shopphonetpl'])) {
                        } else {
                            $contents = Mysite::$app->statichtml($tpllist['userbuytpl'], $tempdata);
                        }
                    }
                    if (!empty($contents)) {
                        /*$time = time();
                                                 $tempstr = md5(Mysite::$app->config['wxtoken'].$time);
                                                 $tempstr = substr($tempstr,3,15);
                                                 $dolink = Mysite::$app->config['siteurl'].'/index.php?controller=wxsite&action=ordershow&orderid='.$orderinfo['id'];
                        
                        
                                                 $backinfo = '';
                                                 if(!empty($dolink)){
                                                        $templink = $dolink;
                                                     for($i=0;$i<strlen($templink);$i++){
                                                       $backinfo .= ord($templink[$i]).',';
                                                     }
                                                 }
                                               // $backinfo =  str_replace(array('"',',','&'),array('-','^','@'),json_encode($dolink));
                                               //shopshoworder
                                               $linkstr =  Mysite::$app->config['siteurl'].'/index.php?controller=wxsite&action=index&openid='.$wxbuyer['openid'].'&actime='.$time.'&sign='.$tempstr.'&backinfo='.$backinfo;
                                               $contents .= '<a href=\''.trim($linkstr).'\'>查看详情</a>';*/
                        if ($wx_s->sendmsg($contents, $wxbuyer['openid'])) {
                        } else {
                            logwrite('微信客服发送错误:' . $wx_s->err());
                        }
                    }
                }
            }
        }
        if (!empty($shopinfo['machine_code']) && !empty($shopinfo['mKey'])) {
            $payarrr = array('outpay' => '到付', 'open_acout' => '余额支付');
            $orderpastatus = $orderinfo['paystatus'] == 1 ? '已支付' : '未支付';
            $orderpaytype = isset($payarrr[$orderinfo['paytype']]) ? $payarrr[$orderinfo['paytype']] : '在线支付';
            $temp_content = '';
            foreach ($orderdet as $km => $vc) {
                $temp_content .= $vc['goodsname'] . '(' . $vc['goodscount'] . '份) \\n ';
            }
            $msg = '商家:' . $shopinfo['shopname'] . '
订餐热线:' . Mysite::$app->config['litel'] . '
订单状态:' . $orderpaytype . ',(' . $orderpastatus . ')
姓名:' . $orderinfo['buyername'] . '
电话:' . $orderinfo['buyerphone'] . '
地址:' . $orderinfo['buyeraddress'] . '
下单时间:' . date('m-d H:i', $orderinfo['addtime']) . '
配送时间:' . date('m-d H:i', $orderinfo['posttime']) . '
*******************************
' . $temp_content . '
*******************************

配送费:' . $orderinfo['shopps'] . '元
合计:' . $orderinfo['allcost'] . '元
※※※※※※※※※※※※※※
谢谢惠顾,欢迎下次光临
订单编号' . $orderinfo['dno'] . '
备注' . $orderinfo['content'] . '
';
            $this->dosengprint($msg, $shopinfo['machine_code'], $shopinfo['mKey']);
        }
        if (in_array(2, $checknotice)) {
            //同时使用邮件通知
            if (Mysite::$app->config['noticeshopemail'] == 1) {
                //同时使用邮件通知
                if (IValidate::email($shopinfo['email'])) {
                    $default_tpl = new config('tplset.php', hopedir);
                    $tpllist = $default_tpl->getInfo();
                    if (!isset($tpllist['emailorder']) || empty($tpllist['emailorder'])) {
                        logwrite('邮件发送商家模板加载失败');
                    } else {
                        //surelink
                        //算方计算
                        $time = time();
                        $tempstr = md5($orderinfo['dno'] . $time);
                        $tempstr = substr($tempstr, 3, 15);
                        $tempstr = md5($orderinfo['shopuid'] . $tempstr);
                        $tempstr = substr($tempstr, 3, 15);
                        $tempdata['surelink'] = Mysite::$app->config['siteurl'] . '/index.php?controller=site&action=makeshow&id=' . $orderinfo['id'] . '&actime=' . $time . '&sign=' . $tempstr . '&status=1';
                        $tempdata['closelink'] = Mysite::$app->config['siteurl'] . '/index.php?controller=site&action=makeshow&id=' . $orderinfo['id'] . '&actime=' . $time . '&sign=' . $tempstr . '&status=2';
                        $emailcontent = Mysite::$app->statichtml($tpllist['emailorder'], $tempdata);
                        $title = '您有一笔' . Mysite::$app->config['sitename'] . '新订单,请尽快处理';
                        $info = $smtp->send($shopinfo['email'], Mysite::$app->config['emailname'], $title, $emailcontent, "", "HTML", "", "");
                    }
                } else {
                    logwrite('商家' . $shopinfo['shopname'] . '邮箱地址' . $shopinfo['shopemail'] . '错误');
                }
            }
        }
        $contents = '';
        if (Mysite::$app->config['allowedsendbuyer'] == 1) {
            if (IValidate::suremobi($orderinfo['buyerphone'])) {
                $default_tpl = new config('tplset.php', hopedir);
                $tpllist = $default_tpl->getInfo();
                if (!isset($tpllist['userbuytpl']) || empty($tpllist['userbuytpl'])) {
                    logwrite('短信发送会员模版失败');
                } else {
                    $contents = Mysite::$app->statichtml($tpllist['userbuytpl'], $tempdata);
                    if (Mysite::$app->config['smstype'] == 2) {
                        //139邮箱转发短信
                        //使用sms10086cn发送
                        $APIServer = 'http://www.sms-10086.cn/Service.asmx/sendsms?';
                        $weblink = $APIServer . 'zh=' . trim(Mysite::$app->config['sms86ac']) . '&mm=' . trim(Mysite::$app->config['sms86pd']) . '&hm=' . $orderinfo['buyerphone'] . '&nr=' . urlencode($contents) . '&dxlbid=27';
                        $contentcccc = file_get_contents($weblink);
                        logwrite('短信sms10086cn发送结果:' . $contentcccc);
                    } else {
                        //使用sms10086cn发送
                        $phoneids = array();
                        $phoneids[] = $orderinfo['buyerphone'];
                        $chekcinfo = $sendmobile->sendsms($phoneids, $contents);
                        logwrite('亿美短信接口发送结果:' . $chekcinfo);
                    }
                    logwrite($contents);
                }
            }
        }
    }
コード例 #17
0
ファイル: site.php プロジェクト: Wen1750686723/utao
 function email_registry()
 {
     $email = IReq::get('email');
     $result = array('isError' => true);
     if (!IValidate::email($email)) {
         $result['message'] = '请填写正确的email地址';
     } else {
         $emailRegObj = new IModel('email_registry');
         $emailRow = $emailRegObj->getObj('email = "' . $email . '"');
         if (!empty($emailRow)) {
             $result['message'] = '此email已经订阅过了';
         } else {
             $dataArray = array('email' => $email);
             $emailRegObj->setData($dataArray);
             $status = $emailRegObj->add();
             if ($status == true) {
                 $result = array('isError' => false, 'message' => '订阅成功');
             } else {
                 $result['message'] = '订阅失败';
             }
         }
     }
     echo JSON::encode($result);
 }
コード例 #18
0
ファイル: adminmethod.php プロジェクト: snamper/xiaoshuhaochi
 public function savemember()
 {
     $this->checkadminlogin();
     $uid = intval(IReq::get('uid'));
     $data['username'] = IReq::get('username');
     $data['password'] = IReq::get('password');
     $data['phone'] = IReq::get('phone');
     $data['address'] = IReq::get('address');
     $data['email'] = IReq::get('email');
     $data['group'] = IReq::get('group');
     $data['score'] = IReq::get('score');
     $data['cost'] = IReq::get('cost');
     if (!IValidate::email($data['email'])) {
         $this->message('邮箱格式错误! [&#22909;&#36164;&#28304;&#119;&#119;&#119;&#46;&#109;&#120;&#56;&#48;&#48;&#46;&#99;&#111;&#109;]');
     }
     if (!IValidate::phone($data['phone'])) {
         $this->message('联系电话格式错误! [&#22909;&#36164;&#28304;&#119;&#119;&#119;&#46;&#109;&#120;&#56;&#48;&#48;&#46;&#99;&#111;&#109;]');
     }
     if (empty($data['username'])) {
         $this->message('用户名不能为空 [&#22909;&#36164;&#28304;&#119;&#119;&#119;&#46;&#109;&#120;&#56;&#48;&#48;&#46;&#99;&#111;&#109;]');
     }
     if (empty($uid)) {
         if ($this->memberCls->regester($data['email'], $data['username'], $data['password'], $data['phone'], $data['group'], '', '', $data['cost'], $data['score'])) {
             $this->success('操作成功!');
         } else {
             $this->message($this->memberCls->ero());
         }
     } else {
         if ($this->memberCls->modify($data, $uid)) {
             $this->success('操作成功!');
         } else {
             $this->message($this->memberCls->ero());
         }
     }
     $this->success('操作成功!');
 }