示例#1
0
 /**
  *
  */
 protected function loadMatters()
 {
     $runningMpid = $this->call['mpid'];
     $openid = $this->call['from_user'];
     $news = \TMS_APP::model('matter\\news')->byId($this->set_id);
     $matters = \TMS_APP::model('matter\\news')->getMatters($this->set_id);
     $modelAcl = \TMS_APP::model('acl');
     $members = \TMS_APP::model('user/member')->byOpenid($runningMpid, $openid);
     $matters2 = array();
     foreach ($matters as $m) {
         if ($m->access_control === 'Y' && $news->filter_by_matter_acl === 'Y') {
             $inacl = false;
             foreach ($members as $member) {
                 if ($modelAcl->canAccessMatter($m->mpid, $m->type, $m->id, $member, $m->authapis)) {
                     $inacl = true;
                     break;
                 }
             }
             if (!$inacl) {
                 continue;
             }
         }
         $m->url = \TMS_APP::model('matter\\' . $m->type)->getEntryUrl($runningMpid, $m->id, $openid);
         $matters2[] = $m;
     }
     if (count($matters2) === 0) {
         $m = \TMS_APP::model('matter\\base')->getCardInfoById($news->empty_reply_type, $news->empty_reply_id);
         return $m;
     } else {
         return $matters2;
     }
 }
示例#2
0
 /**
  * 接收消息日志
  */
 public function receive($msg)
 {
     $mpid = $msg['mpid'];
     $openid = $msg['from_user'];
     $fan = TMS_APP::model('user/fans')->byOpenid($mpid, $openid, 'nickname');
     $createAt = $msg['create_at'];
     $r = array();
     $r['mpid'] = $mpid;
     $r['msgid'] = $msg['msgid'];
     $r['to_user'] = $msg['to_user'];
     $r['openid'] = $openid;
     $r['nickname'] = !empty($fan) ? $this->escape($fan->nickname) : '';
     $r['create_at'] = $createAt;
     $r['type'] = $msg['type'];
     if (is_array($msg['data'])) {
         $data = array();
         foreach ($msg['data'] as $d) {
             $data[] = urlencode($d);
         }
         $r['data'] = $this->escape(urldecode(json_encode($data)));
     } else {
         $r['data'] = $this->escape($msg['data']);
     }
     $this->insert('xxt_log_mpreceive', $r, false);
     return true;
 }
示例#3
0
 public function exec()
 {
     $relay = \TMS_APP::model('mp\\relay')->byId($this->relayId);
     /**
      * 公众平台发过来的原始数据
      */
     $data = file_get_contents("php://input");
     $headerArr[] = 'Content-Type: text/xml; charset=utf-8';
     /**
      * 转发数据
      */
     $ch = curl_init($relay->url);
     curl_setopt($ch, CURLOPT_HEADER, 0);
     curl_setopt($ch, CURLOPT_HTTPHEADER, $headerArr);
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
     curl_setopt($ch, CURLOPT_POST, 1);
     curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
     curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
     curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
     if (false === ($rsp = curl_exec($ch))) {
         $err = curl_error($ch);
         curl_close($ch);
         return array(false, $err);
     }
     curl_close($ch);
     die($rsp);
 }
示例#4
0
 /**
  *
  */
 public function index_action($id = null)
 {
     if ($id) {
         $c = $this->model('app\\contribute')->byId($id);
         /**
          * belong to channel
          */
         $c->channels = $this->model('matter\\channel')->byMatter($id, 'contribute');
         /**
          * 参与人
          */
         $c->initiator = $this->model('app\\contribute')->userAcls($this->mpid, $id, 'I');
         $c->reviewer = $this->model('app\\contribute')->userAcls($this->mpid, $id, 'R');
         $c->typesetter = $this->model('app\\contribute')->userAcls($this->mpid, $id, 'T');
         /**
          * return
          */
         $channels = \TMS_APP::model('matter\\channel')->byMpid($this->mpid);
         $params = array('mpid' => $this->mpid, 'app' => $c, 'channels' => $channels);
         \TPL::assign('params', $params);
         $this->view_action('/mp/app/contribute/edit');
     } else {
         $this->view_action('/mp/app/contribute');
     }
 }
示例#5
0
 /**
  *
  */
 public function remove($pageId)
 {
     $page = $this->byId($pageId, array('cascaded' => 'N'));
     \TMS_APP::model('code/page')->remove($page->code_id);
     $rst = $this->delete('xxt_wall_page', "id={$pageId}");
     return $rst;
 }
示例#6
0
 protected function loadMatters()
 {
     $mpid = $this->call['mpid'];
     $page = 1;
     $limit = 5;
     $matters = \TMS_APP::model('matter\\article')->fullsearch_its($mpid, $this->keyword, $page, $limit);
     return $matters;
 }
示例#7
0
 /**
  *
  */
 public function getEntryUrl($runningMpid, $id, $openid = null, $call = null)
 {
     if (isset($matter->urlsrc)) {
         /**
          * link
          */
         switch ($matter->urlsrc) {
             case 0:
                 // external link
                 if ($matter->open_directly === 'Y') {
                     $url = $matter->url;
                     $q = array('pname,pvalue,authapi_id', 'xxt_link_param', "link_id={$matter->id}");
                     if ($params = $this->query_objs_ss($q)) {
                         $url .= strpos($url, '?') === false ? '?' : '&';
                         $url .= $this->spliceParams($runningMpid, $params, null, $openid);
                     }
                     if (preg_match('/^(http:|https:)/', $url) === 0) {
                         $url = 'http://' . $url;
                     }
                     return $url;
                 } else {
                     $url = "?mpid={$runningMpid}&id={$matter->id}&type=link";
                 }
                 break;
             case 1:
                 // news
                 $url = "?mpid={$runningMpid}&type=news&id=" . $matter->url;
                 break;
             case 2:
                 // channel
                 $url = "?mpid={$runningMpid}&type=channel&id=" . $matter->url;
                 break;
             case 3:
                 // inner
                 $reply = TMS_APP::model('reply\\inner', $call, $matter->url);
                 $url = $reply->exec(false);
                 $q = array('pname,pvalue,authapi_id', 'xxt_link_param', "link_id={$matter->id}");
                 if ($params = $this->query_objs_ss($q)) {
                     $url .= strpos($url, '?') === false ? '?' : '&';
                     $url .= $this->spliceParams($runningMpid, $params, null, $openid);
                 }
                 if (preg_match('/^(http:|https:)/', $url) === 0) {
                     $url = 'http://' . $url;
                 }
                 return $url;
             default:
                 die('unknown link urlsrc.');
         }
     } else {
         $url = "http://" . $_SERVER['HTTP_HOST'] . "/rest/mi/matter";
         $url .= "?mpid={$runningMpid}&id={$id}&type=" . $this->getTypeName();
         if (!empty($openid)) {
             $url .= "&openid={$openid}";
         }
         return $url;
     }
 }
示例#8
0
 /**
  * 如果频道设置了【固定标题】,要用固定标题替换掉第一个图文的标题
  */
 protected function loadMatters()
 {
     $mpid = $this->call['mpid'];
     $model = \TMS_APP::model('matter\\channel');
     $matters = $model->getMatters($this->set_id, null, $mpid);
     $channel = $model->byId($this->set_id, 'fixed_title');
     if (!empty($matters) && !empty($channel->fixed_title)) {
         $matters[0]->title = $channel->fixed_title;
     }
     return $matters;
 }
示例#9
0
 /**
  *
  * $call
  * $content 回复的内容
  * $referred 指明$content是直接回复的内容,还是定义的文本素材
  */
 public function __construct($call, $content, $referred = true)
 {
     parent::__construct($call);
     if ($referred) {
         if ($txt = \TMS_APP::model('matter\\text')->byId($content, 'content')) {
             $content = $txt->content;
         } else {
             $content = "文本回复【{$content】不存在}";
         }
     }
     $this->content = $content;
 }
示例#10
0
 /**
  * 返回进行推送的客服消息格式
  *
  * $runningMpid
  * $id
  *
  */
 public function &forCustomPush($runningMpid, $id)
 {
     $matters = $this->getMatters($id);
     $ma = array();
     foreach ($matters as $m) {
         if (!empty($m->pic) && stripos($m->pic, 'http') === false) {
             $pic = 'http://' . $_SERVER['HTTP_HOST'] . $m->pic;
         } else {
             $pic = $m->pic;
         }
         $ma[] = array('title' => urlencode($m->title), 'description' => urlencode($m->summary), 'url' => \TMS_APP::model('matter\\' . $m->type)->getEntryUrl($runningMpid, $m->id), 'picurl' => urlencode($pic));
     }
     $msg = array('msgtype' => 'news', 'news' => array('articles' => $ma));
     return $msg;
 }
示例#11
0
 /**
  * 获得执行链接的结果
  */
 private function output($link, $openid)
 {
     $url = $link->url;
     if (preg_match('/^(http:|https:)/', $url) === 0) {
         $url = 'http://' . $url;
     }
     if (isset($link->params)) {
         $params = \TMS_APP::model('reply')->spliceParams($link->mpid, $link->params, null, $openid);
     }
     if ($link->method == 'GET' && isset($this->params)) {
         $url .= strpos($url, '?') === false ? '?' : '&';
         $url .= $params;
     }
     $ch = curl_init();
     //初始化curl
     curl_setopt($ch, CURLOPT_URL, $url);
     //设置链接
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
     //设置是否返回信息
     //curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
     curl_setopt($ch, CURLOPT_REFERER, 1);
     curl_setopt($ch, CURLOPT_HEADER, 1);
     //设置返回的信息是否包含http头
     if ($link->method === 'POST') {
         curl_setopt($ch, CURLOPT_POST, 1);
         //设置为POST方式
         if (!empty($params)) {
             $header = array("Content-type: application/x-www-form-urlencoded");
             curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
             curl_setopt($ch, CURLOPT_POSTFIELDS, $posted);
         }
     }
     $response = curl_exec($ch);
     if (curl_errno($ch)) {
         $output = curl_error($ch);
     } else {
         /**
          * 返回内容
          */
         $headerSize = curl_getinfo($ch, CURLINFO_HEADER_SIZE);
         $output = substr($response, $headerSize);
     }
     curl_close($ch);
     return $output;
 }
示例#12
0
 /**
  * $doResponse 是否执行相应。因为易信二维码需要通过推送客服消息的方式返回相应。
  */
 public function exec($doResponse = true)
 {
     /**
      * 当前用户加入活动
      */
     $wall = \TMS_APP::model('app\\wall');
     $mpid = $this->call['mpid'];
     $openid = $this->call['from_user'];
     $desc = $wall->join($mpid, $this->wid, $openid, $this->remark);
     /**
      * 返回活动加入成功提示
      */
     if ($doResponse) {
         $r = $this->textResponse($desc);
         die($r);
     } else {
         return $desc;
     }
 }
示例#13
0
 /**
  *
  */
 public function exec()
 {
     /**
      * 当前用户活动签到
      */
     $mpid = $this->call['mpid'];
     $openid = $this->call['from_user'];
     $model = \TMS_APP::model('app\\enroll');
     $act = $model->byId($this->aid);
     $rst = $model->signin($mpid, $this->aid, $openid);
     /**
      * 回复
      */
     if ($rst) {
         if ($act->success_matter_type && $act->success_matter_id) {
             $cls = $act->success_matter_type;
             if ($this->directReply === true) {
                 $r = \TMS_APP::model('reply\\' . $cls, $this->call, $act->success_matter_id);
             } else {
                 return array('matter_type' => $act->success_matter_type, 'matter_id' => $act->success_matter_id);
             }
         } else {
             $r = \TMS_APP::model('reply\\text', $this->call, "活动【" . $act->title . "】已签到,已登记", false);
         }
     } else {
         if ($act->failure_matter_type && $act->failure_matter_id) {
             $cls = $act->failure_matter_type;
             if ($this->directReply === true) {
                 $r = \TMS_APP::model('reply\\' . $cls, $this->call, $act->failure_matter_id);
             } else {
                 return array('matter_type' => $act->failure_matter_type, 'matter_id' => $act->failure_matter_id);
             }
         } else {
             $r = \TMS_APP::model('reply\\text', $this->call, "活动【" . $act->title . "】已签到,未登记", false);
         }
     }
     $r->exec();
 }
示例#14
0
 /**
  * 获得菜单按钮定义
  *
  * 每个菜单按钮有两个状态,编辑状态和发布状态,缺省返回编辑状态
  */
 public function &getButtonById($mpid, $key, $published = 'N', $fields = '*', $cascade = array())
 {
     /**
      * 获得最新版本号
      */
     if ($version = $this->getVersion($mpid, $published)) {
         $q = array($fields, 'xxt_call_menu', "mpid='{$mpid}' and menu_key='{$key}' and version={$version->v}");
         if ($button = $this->query_obj_ss($q)) {
             /**
              * 回复素材
              */
             if (in_array('matter', $cascade) && $button->matter_id) {
                 $button->matter = \TMS_APP::model('matter\\base')->getMatterInfoById($button->matter_type, $button->matter_id);
             }
             /**
              * 访问控制列表
              */
             if (in_array('acl', $cascade)) {
                 /*$q = array(
                       'a.id,a.identity,a.idsrc,d.name dept',
                       "xxt_call_acl a left join xxt_member_department d on a.idsrc='D' and a.mpid=d.mpid and a.identity=d.id",
                       "a.mpid='$button->mpid' and a.call_type='Menu' and a.keyword='$key'");
                   $acl = $this->query_objs_ss($q);
                   if (!empty($acl)) {
                       $button->acl = $acl;
                   } else {
                       $button->acl = array();
                   }*/
                 $button->acl = \TMS_APP::model('acl')->menuCall($button->mpid, $key);
             }
         }
     } else {
         $button = array();
     }
     return $button;
 }
示例#15
0
 /**
  * 创建活动页面
  */
 public function add($mpid, $aid, $data = null)
 {
     $uid = \TMS_CLIENT::get_client_uid();
     $code = \TMS_APP::model('code/page')->create($uid);
     if (empty($data['seq'])) {
         $q = array('max(seq)', 'xxt_enroll_page', "aid='{$aid}'");
         $seq = $this->query_val_ss($q);
         $seq = empty($seq) ? 1 : $seq + 1;
     } else {
         $seq = $data['seq'];
     }
     $newPage = array('mpid' => $mpid, 'aid' => $aid, 'creater' => $uid, 'create_at' => time(), 'type' => isset($data['type']) ? $data['type'] : 'V', 'title' => isset($data['title']) ? $data['title'] : '新页面', 'name' => isset($data['name']) ? $data['name'] : 'z' . time(), 'code_id' => $code->id, 'seq' => $seq);
     $apid = $this->insert('xxt_enroll_page', $newPage, true);
     $newPage['id'] = $apid;
     $newPage['html'] = '';
     $newPage['css'] = '';
     $newPage['js'] = '';
     return (object) $newPage;
 }
示例#16
0
 protected function loadMatters()
 {
     $a = \TMS_APP::model('matter\\base')->getCardInfoById('enroll', $this->set_id);
     return array($a);
 }
示例#17
0
 /**
  * 获得model对象
  *
  * $path
  */
 public static function M($path)
 {
     return TMS_APP::model($path);
 }
示例#18
0
 /**
  *
  * $img
  */
 public function storeImg($img)
 {
     if (empty($img->imgSrc) && !isset($img->serverId)) {
         return array(false, '数据为空');
     }
     if (isset($img->imgSrc) && 0 === strpos($img->imgSrc, 'http')) {
         $rst = $this->storeUrl($img->imgSrc);
     } else {
         if (isset($img->imgSrc) && 1 === preg_match('/data:image(.+?);base64/', $img->imgSrc)) {
             /**
              * base64
              */
             $rst = $this->storeBase64Image($img->imgSrc);
         } else {
             if (isset($img->serverId)) {
                 /**
                  * wx jssdk
                  */
                 $rst = TMS_APP::model('mpproxy/wx', $this->mpid)->mediaGetUrl($img->serverId);
                 if ($rst[0] === false) {
                     return $rst;
                 }
                 $rst = $this->storeUrl($rst[1]);
             } else {
                 return array(false, '数据格式错误');
             }
         }
     }
     return $rst;
 }
示例#19
0
 protected function loadMatters()
 {
     $article = \TMS_APP::model('matter\\article')->byId($this->set_id, 'id,title,summary,pic');
     $article->type = 'article';
     return array($article);
 }
示例#20
0
 /**
  * 通知活动管理员
  */
 private function notifyAdmin($mpid, $act, $ek, $user)
 {
     $admins = \TMS_APP::model('acl')->enrollReceivers($mpid, $act->id);
     if (false !== ($key = array_search($user->openid, $admins))) {
         /* 管理员是登记人,不再通知 */
         unset($admins[$key]);
     }
     if (!empty($admins)) {
         $url = 'http://' . $_SERVER['HTTP_HOST'] . "/rest/app/enroll?mpid={$mpid}&aid={$act->id}&ek={$ek}&page={$act->receiver_page}";
         $txt = urlencode("【" . $act->title . "】有新登记数据,");
         $txt .= "<a href=\"{$url}\">";
         $txt .= urlencode("请处理");
         $txt .= "</a>";
         $message = array("msgtype" => "text", "text" => array("content" => $txt));
         $mpa = $this->model('mp\\mpaccount')->getApis($mpid);
         if ($mpa->mpsrc === 'qy') {
             $message['touser'] = implode('|', $admins);
             $this->send_to_qyuser($mpid, $message);
         } else {
             if ($mpa->mpsrc === 'yx' && $mpa->yx_p2p === 'Y') {
                 $this->send_to_yxuser_byp2p($mpid, $message, $admins);
             } else {
                 foreach ($admins as $admin) {
                     $this->sendByOpenid($mpid, $admin, $message);
                 }
             }
         }
     }
     return true;
 }
示例#21
0
 /**
  * 企业号信息加密处理
  */
 protected function encrypt($msg)
 {
     $sEncryptMsg = "";
     //xml格式的密文
     $timestamp = time();
     $nonce = uniqid();
     $app = \TMS_APP::model('mp\\mpaccount')->byId($this->call['mpid']);
     $wxcpt = new WXBizMsgCrypt($app->token, $app->qy_encodingaeskey, $app->qy_corpid);
     $errCode = $wxcpt->EncryptMsg($msg, $timestamp, $nonce, $sEncryptMsg);
     if ($errCode != 0) {
         TMS_APP::model('log')->log($this->call['mpid'], $this->content, $errCode);
         exit;
     }
     return $sEncryptMsg;
 }
示例#22
0
 /**
  * 保存登记的数据
  */
 public function setData($user, $runningMpid, $aid, $ek, $data, $submitkey = '')
 {
     if (empty($data)) {
         return array(true);
     }
     if (empty($submitkey)) {
         $submitkey = $user->vid;
     }
     // 已有的登记数据
     $fields = $this->query_vals_ss(array('name', 'xxt_enroll_record_data', "aid='{$aid}' and enroll_key='{$ek}'"));
     foreach ($data as $n => $v) {
         /**
          * 插入自定义属性
          */
         if ($n === 'member' && is_object($v)) {
             /* 用户认证信息 */
             $vv = new \stdClass();
             isset($v->name) && ($vv->name = urlencode($v->name));
             isset($v->email) && ($vv->email = urlencode($v->email));
             isset($v->mobile) && ($vv->mobile = urlencode($v->mobile));
             if (!empty($v->extattr)) {
                 $extattr = new \stdClass();
                 foreach ($v->extattr as $mek => $mev) {
                     $extattr->{$mek} = urlencode($mev);
                 }
                 $vv->extattr = $extattr;
             }
             $vv = urldecode(json_encode($vv));
         } else {
             if (is_array($v) && (isset($v[0]->serverId) || isset($v[0]->imgSrc))) {
                 /* 上传图片 */
                 $vv = array();
                 $fsuser = \TMS_APP::model('fs/user', $runningMpid);
                 foreach ($v as $img) {
                     $rst = $fsuser->storeImg($img);
                     if (false === $rst[0]) {
                         return $rst;
                     }
                     $vv[] = $rst[1];
                 }
                 $vv = implode(',', $vv);
             } else {
                 if (is_array($v) && isset($v[0]->uniqueIdentifier)) {
                     /* 上传文件 */
                     $fsUser = \TMS_APP::M('fs/local', $runningMpid, '_user');
                     $fsResum = \TMS_APP::M('fs/local', $runningMpid, '_resumable');
                     $fsAli = \TMS_APP::M('fs/alioss', $runningMpid);
                     $vv = array();
                     foreach ($v as $file) {
                         if (defined('SAE_TMP_PATH')) {
                             $dest = '/' . $aid . '/' . $submitkey . '_' . $file->name;
                             $fileUploaded2 = $fsAli->getBaseURL() . $dest;
                         } else {
                             $fileUploaded = $fsResum->rootDir . '/' . $submitkey . '_' . $file->uniqueIdentifier;
                             !file_exists($fsUser->rootDir . '/' . $submitkey) && mkdir($fsUser->rootDir . '/' . $submitkey, 0777, true);
                             $fileUploaded2 = $fsUser->rootDir . '/' . $submitkey . '/' . $file->name;
                             if (false === rename($fileUploaded, $fileUploaded2)) {
                                 return array(false, '移动上传文件失败');
                             }
                         }
                         unset($file->uniqueIdentifier);
                         $file->url = $fileUploaded2;
                         $vv[] = $file;
                     }
                     $vv = json_encode($vv);
                 } else {
                     if (is_string($v)) {
                         $vv = $this->escape($v);
                     } else {
                         if (is_object($v) || is_array($v)) {
                             $vv = implode(',', array_keys(array_filter((array) $v, function ($i) {
                                 return $i;
                             })));
                         } else {
                             $vv = $v;
                         }
                     }
                 }
             }
         }
         if (!empty($fields) && in_array($n, $fields)) {
             $this->update('xxt_enroll_record_data', array('value' => $vv), "aid='{$aid}' and enroll_key='{$ek}' and name='{$n}'");
             unset($fields[array_search($n, $fields)]);
         } else {
             $ic = array('aid' => $aid, 'enroll_key' => $ek, 'name' => $n, 'value' => $vv);
             $this->insert('xxt_enroll_record_data', $ic, false);
         }
     }
     return array(true);
 }
示例#23
0
 /**
  *
  * todo 需要处理多个回车换行的问题
  */
 public function output($runningMpid, $mid, $vid, $ctrl)
 {
     if (!$this->article) {
         return false;
     }
     /**
      * output an article
      */
     $data = array();
     $this->article->shareby = $this->shareby;
     $data['mpid'] = $runningMpid;
     $visitor = new \stdClass();
     $visitor->openid = $this->openid;
     $visitor->vid = $vid;
     $data['visitor'] = $visitor;
     $user_agent = $_SERVER['HTTP_USER_AGENT'];
     if (preg_match('/yixin/i', $user_agent)) {
         if ($mp = \TMS_APP::model()->query_obj('yx_cardname,yx_cardid', 'xxt_mpaccount', "mpid='{$runningMpid}'")) {
             $yx_cardname = $mp->yx_cardname;
             $yx_cardid = $mp->yx_cardid;
         }
     }
     \TPL::assign('yx_cardid', empty($yx_cardid) ? false : $yx_cardid);
     \TPL::assign('yx_cardname', empty($yx_cardname) ? false : $yx_cardname);
     /**
      * 页面背景设置
      */
     $mpsetting = $ctrl->getMpSetting($runningMpid);
     \TPL::assign('body_ele', $mpsetting->body_ele);
     \TPL::assign('body_css', $mpsetting->body_css);
     /**
      * 补充数据
      */
     $model = \TMS_APP::model('matter\\article');
     /**
      * 评价信息
      */
     $user = $this->getUser($runningMpid);
     $this->article->praised = $model->praised($user, $this->article->id);
     /**
      * 评论
      */
     $this->article->remarks = $mpsetting->can_article_remark === 'Y' ? $model->remarks($this->article->id) : false;
     $data['article'] = $this->article;
     \TPL::assign('data', $data);
     /**
      * 选择模板
      */
     if ($this->article->custom_body === 'N') {
         \TPL::output('article');
     } else {
         \TPL::assign('title', $this->article->title);
         $nl = array("\r\n", "\n", "\r");
         if ($this->article->page_id) {
             $page = \TMS_APP::M('code/page')->byId($this->article->page_id);
             $page->html && \TPL::assign('body', $page->html);
             $page->css && \TPL::assign('css', $page->css);
             $page->js && \TPL::assign('js', $page->js);
             \TPL::assign('ext_js', $page->ext_js);
             \TPL::assign('ext_css', $page->ext_css);
         } else {
             $body = str_replace($nl, '', $this->article->body);
             \TPL::assign('body', $body);
             $this->article->css && \TPL::assign('css', $this->article->css);
         }
         \TPL::output('custom');
     }
 }
示例#24
0
 /**
  *
  */
 public function getPersonByAb($mpid, $abid, $abbr = null, $dept_id = null, $offset = 0, $limit = null)
 {
     $mpa = \TMS_APP::model('mp\\mpaccount')->byId($mpid, 'parent_mpid');
     //
     $cols = 'SQL_CALC_FOUND_ROWS id,name,email,tels';
     $from = 'xxt_ab_person';
     $where = "(mpid='{$mpid}' or mpid='{$mpa->parent_mpid}')";
     if (!empty($abid)) {
         $where .= " and ab_id={$abid}";
     }
     if ($abbr) {
         if (ord($abbr[0]) > 0x80) {
             $where .= " and (name like '%{$abbr}%')";
         } else {
             //ascii
             $abbr_len = strlen($abbr);
             $abbr_cond = ".*";
             for ($i = 0; $i < $abbr_len; $i++) {
                 $abbr_cond .= $abbr[$i] . ".*";
             }
             $where .= " and ((pinyin regexp '";
             $where .= $abbr_cond;
             $where .= "') = 1)";
         }
     }
     if ($dept_id) {
         $where .= " and (";
         $where .= " id in(";
         $where .= "select person_id from xxt_ab_person_dept";
         $where .= " where dept_id = {$dept_id}";
         $where .= ")";
         $where .= ")";
     }
     //
     $result = new \stdClass();
     $result->objects = $this->query_objs($cols, 'xxt_ab_person', $where, null, null, $offset, $limit);
     $result->amount = $this->found_rows();
     return $result;
 }
示例#25
0
 /**
  *
  */
 public function test_action($mpid, $order)
 {
     $order = \TMS_APP::model('app\\merchant\\order')->byId($order);
     $this->notify($mpid, $order);
     return new \ResponseData('ok');
 }
示例#26
0
 protected function loadMatters()
 {
     $w = \TMS_APP::model('app\\wall')->byId($this->set_id);
     $w->type = 'wall';
     return array($w);
 }
示例#27
0
 protected function loadMatters()
 {
     $l = \TMS_APP::model('matter\\base')->getCardInfoById('lottery', $this->set_id);
     return array($l);
 }
示例#28
0
 protected function loadMatters()
 {
     $ab = \TMS_APP::model('matter\\base')->getCardInfoById('addressbook', $this->set_id);
     return array($ab);
 }
示例#29
0
 /**
  *
  */
 public function oauthUrl($mpid, $redirect, $state = null)
 {
     $mpa = TMS_APP::model('mp\\mpaccount')->byId($mpid, 'yx_appid');
     $oauth = "http://open.plus.yixin.im/connect/oauth2/authorize";
     $oauth .= "?appid={$mpa->yx_appid}";
     $oauth .= "&redirect_uri=" . urlencode($redirect);
     $oauth .= "&response_type=code";
     $oauth .= "&scope=snsapi_base";
     !empty($state) && ($oauth .= "&state={$state}");
     $oauth .= "#yixin_redirect";
     return $oauth;
 }
示例#30
0
 /**
  * 获得积分奖励
  */
 public function earnCredits($lid, $mid, $openid, &$award)
 {
     $credits = $award['quantity'];
     \TMS_APP::model('user/member')->addCredits($mid, $credits);
     return true;
 }