Example #1
0
 public function test()
 {
     $weObj = new \System\lib\Wechat\Template($this->config("WEIXIN_CONFIG"));
     $openid = "o_Oqut6MX4_AenAYe9vTmcMpZYnk";
     $content = "text";
     $weObj->setTemplate($openid, $content);
     if ($weObj) {
         echo "yes!";
     }
 }
Example #2
0
 /**
  * 确认订单
  */
 public function billConfirm()
 {
     $this->V(['bill_id' => ['egNum', null, true]]);
     $id = intval($_POST['bill_id']);
     $bill = $this->table('bill')->where(['id' => $id, 'is_on' => 1, 'is_confirm' => 0])->get(['id'], true);
     if (!$bill) {
         $this->R('', 70009);
     }
     $bill = $this->table('bill')->where(['id' => $id])->update(['is_confirm' => 1, 'is_cancel' => 0, 'status' => 1]);
     if (!$bill) {
         $this->R('', 40001);
     }
     //发送消息通知用户
     $bills = $this->table('bill')->where(['id' => $id])->get(['user_id', 'goods_id', 'thematic_id'], true);
     if (!$bills) {
         $this->R('', 40001);
     }
     $user = $this->table('user')->where(['id' => $bills['user_id']])->get(['openid', 'phone'], true);
     $openid = $user['openid'];
     $phone = $user['phone'];
     $goods = $this->table('goods')->where(['id' => $bills['goods_id']])->get(['goods_name'], true);
     $goods_name = $goods['goods_name'];
     $thematic = $this->table('thematic')->where(['id' => $bills['thematic_id']])->get(['thematic_name'], true);
     $thematic_name = $thematic['thematic_name'];
     $content = "尊敬的一团云购用户,恭喜您抽中了" . $thematic_name . "商品" . $goods_name . ",请及时查看并完善您的收货地址信息,方便我们为您送货。谢谢配合。";
     //微信公众号提醒
     $weObj = new \System\lib\Wechat\Template($this->config("WEIXIN_CONFIG"));
     $weObj->setTemplate($openid, $content);
     //手机短信提醒
     $sendMessage = new \System\AppTools();
     $sendMessage = $sendMessage->sendSms($phone, $content);
     $this->R();
 }