コード例 #1
0
 private function _sendQIYENotice(&$rs, $type = 1, $userId = 0)
 {
     $loginType = 0;
     //登陆身份类型,0:未定义 1:配货员 2:小管家 3:社长
     $gotoUrl = 'steward/worker/orderdetail';
     $msgType = 'news';
     switch ($type) {
         case 1:
             //配货
             $title = '配货员:您有新的订单需要完成【采购】,用户:【' . $rs['username'] . '】';
             $desc = "订单号:{$rs['order_sn']}\n请点击进入页面确认采购完成";
             $loginType = 1;
             break;
         case 2:
             //小管家配送
             $title = '小管家:您有新的订单需要【配送】,用户:【' . $rs['username'] . '】';
             $desc = "订单号:{$rs['order_sn']}\n地址:{$rs['address']}\n收货人:{$rs['username']}\n电话:{$rs['phone']}\n请在送达以后点击进入确认配送完成";
             $loginType = 2;
             $gotoUrl = 'steward/worker/detail';
             break;
         case 3:
             //订单信息变更
             $title = '小管家:订单【已变更】,请注意配送信息,用户:【' . $rs['username'] . '】';
             $desc = "订单号:{$rs['order_sn']}\n地址:{$rs['address']}\n收货人:{$rs['username']}\n电话:{$rs['phone']}\n请在送达以后点击进入确认配送完成";
             $loginType = 2;
             $gotoUrl = 'steward/worker/detail';
             break;
         case 4:
             //取消已分配的订单
             $msgType = 'text';
             $title = "订单【已重新分配】,请注意配送信息,用户:【" . $rs['username'] . "】\n";
             $desc = "订单已分配给其他小管家处理\n订单号:{$rs['order_sn']}\n地址:{$rs['address']}\n收货人:{$rs['username']}\n电话:{$rs['phone']}";
             $loginType = 2;
             break;
         default:
             $this->JsonReturn('企业号操作类型不正确');
     }
     if (!$userId) {
         $this->JsonReturn('请先选择操作员');
     }
     T('weixin/qy/qyWeixin.api');
     qyApi::init(steadmin::$adminInfo['city_id']);
     $touser = D('steadmin')->getUserOpenid($userId);
     if (!$touser) {
         $this->JsonReturn('小管家系统用户不存在(user_id:' . $userId . ')');
     }
     if ($msgType == 'text') {
         $sendInfo = array('touser' => $touser, 'msgtype' => 'text', 'text' => array('content' => $title . $desc));
     } else {
         $sendInfo = array('touser' => $touser, 'msgtype' => 'news', 'news' => array('articles' => array(array('title' => $title, 'createTime' => TIME, 'description' => $desc, 'picurl' => '', 'url' => U($gotoUrl, array('oid' => $rs['order_id'], 'type' => $loginType, 'userid' => $userId))))));
     }
     return array('user_id' => $userId, 'name' => parent::_getAdminName($userId), 'result' => qyApi::messageSend($sendInfo) ? 1 : 0, 'msg' => qyApi::$errorMsg);
 }
コード例 #2
0
 private function _sendQIYENotice($touser)
 {
     if (!$touser) {
         $this->JsonReturn('请先选择帐号');
     }
     T('weixin/qy/qyWeixin.api');
     qyApi::init(steadmin::$adminInfo['city_id']);
     if (!$touser) {
         $this->JsonReturn('小管家系统用户不存在');
     }
     $sendInfo = array('touser' => $touser, 'msgtype' => 'news', 'news' => array('articles' => array(array('title' => '测试企业号是否关注', 'createTime' => TIME, 'description' => "确认你已经收到消息了...", 'picurl' => '', 'url' => ''))));
     return array('user_id' => 1, 'name' => $touser, 'result' => qyApi::messageSend($sendInfo) ? 1 : 0, 'msg' => qyApi::$errorMsg);
 }