예제 #1
0
 protected static function init_auto_keyword()
 {
     //判断是否为 微笑  发送 UC 自动登录链接
     if (preg_match('/^\\/微笑$/', self::$weixin_post['content'])) {
         $autoinfo = M('Weixinmember')->where(array('fromusername' => session('from')))->field('nickname,ucusername,ucpassword')->find();
         $autolink = U('Home/User/login', $autoinfo, '', true);
         $other = "【内置关键词】\n发送“我叫***”即可改昵称";
         wx_success("亲爱的{$autoinfo['nickname']}\nUC账号:{$autoinfo['ucusername']}\nUC密码:{$autoinfo['ucpassword']}\r\n<a href='{$autolink}'>自动登录网页版</a>\n" . $other);
     }
 }
예제 #2
0
 public function index($param)
 {
     global $_W, $_P;
     //获取插件配置
     $config = Amango_Addons_Config('Sharephotos');
     $nowtime = time();
     if (!empty($_W['picurl'])) {
         //限制每天分享的图片数量
         $todaystart = strtotime(date('Y-m-d 00:00:00', $nowtime));
         $todayend = strtotime(date('Y-m-d 23:59:59', $nowtime));
         $condition = array('from' => $_P['fromusername'], 'sharetime' => array('egt', $todaystart), 'sharetime' => array('elt', $todayend));
         $hassharenums = M('Addonssharepics')->where($condition)->count();
         if ($hassharenums >= $config['shareitmes']) {
             $this->assign('Text', "[可怜]亲~您今天已分享了" . $config['shareitmes'] . "次\n请明天再分享吧!");
             $this->display();
         }
         $article[0] = array('Title' => "分享图片成功", 'Description' => "请回复下你对这张照片的评价吧~", 'PicUrl' => $_W['picurl'], 'Url' => $_W['picurl']);
         //锁定图片分享模式
         $this->lock('model', 'Sharephotos');
         //缓存微信图片链接
         $this->cache('sharepicurl', $_W['picurl']);
         $this->assign('Duotw', $article);
         $this->display();
     } else {
         //判断是否存在模式锁定
         $lastmodel = $this->locked('model');
         $urlcache = $this->cache('sharepicurl');
         if (!empty($lastmodel) && !empty($_W['content']) && !empty($urlcache)) {
             //远程保存图片至本地数据库
             $urldown = $this->savepics($urlcache);
             //将照片地址写入数据库 初始化浏览量为1
             $data = array('from' => $_P['fromusername'], 'nickname' => $_P['nickname'], 'picurl' => $urldown, 'sharetime' => $nowtime, 'content' => $_W['content'], 'views' => 1, 'status' => $config['random']);
             M('Addonssharepics')->add($data);
             //清除缓存
             $this->cache('sharepicurl', NULL);
             //清除模块锁定
             $this->lock('model', '');
             //评价照片
             $commonurl = $this->create_loginurl('index');
             $article[0] = array('Title' => "分享图片成功", 'Description' => "分享理由:" . $_W['content'], 'PicUrl' => $urlcache, 'Url' => $commonurl);
             $this->assign('Duotw', $article);
             $this->display();
         } else {
             //展示图片分享内容  底部附带分享方法
             $article[0] = array('Title' => "精彩美图,随手分享", 'Description' => "", 'PicUrl' => str_replace('./', 'http://' . $_SERVER['HTTP_HOST'] . '/', ONETHINK_ADDON_PATH . 'Sharephotos/Public/banner.jpg'), 'Url' => $this->create_loginurl('index'));
             $gebi = array_merge($article, $this->show(6));
             $this->assign('Duotw', $gebi);
             $this->display();
         }
     }
     wx_error(json_encode($_W));
     die;
     wx_success('Hello World!这是图吧的微信Bundle!');
 }
예제 #3
0
 protected function kuaidi($param)
 {
     global $_W;
     $content = str_replace('+', '', $_W['content']);
     $content = str_replace(' ', '', $content);
     if (strstr($_W['content'], '快递')) {
         wx_success("【快递名字+单号】查询快递\n圆通  中通  申通  顺丰  韵达  邮政 EMS\n例查圆通发送:圆通2728435536\n例查中通发送:中通778044381976");
     }
     $kuaidic = array();
     $kuaidil = array();
     //单号长度
     $kuaidic["圆通"] = 10;
     $kuaidic["申通"] = 12;
     $kuaidic["中通"] = 12;
     $kuaidic["顺丰"] = 12;
     $kuaidic["邮政"] = 13;
     $kuaidic["韵达"] = 13;
     //快递标识
     $kuaidil["圆通"] = "yuantong";
     $kuaidil["中通"] = "zhongtong";
     $kuaidil["申通"] = "shentong";
     $kuaidil["顺丰"] = "shunfeng";
     $kuaidil["邮政"] = "ems";
     $kuaidil["韵达"] = "yunda";
     //提取单号
     $kuaiditype = msubstr($_W['content'], "0", "2", $charset = "utf-8", $suffix = false);
     $danhao = str_replace($kuaiditype, '', $content);
     if (strlen($danhao) != $kuaidic[$kuaiditype]) {
         wx_error("【快递名字+单号】查询快递\n圆通  中通  申通  顺丰  韵达  邮政 EMS\n检查快递单号长度是否填写正确");
     } else {
         //获取该插件配置参数
         $config = Amango_Addons_Config();
         $config['kuaidiak'] || wx_error('请联系站长先填写快递API的密匙');
         $url = 'http://api.ickd.cn/?com=' . $kuaidil[$kuaiditype] . '&nu=' . $danhao . '&id=82CD8E8282C652F91CAEE36225FD2373&type=text&encode=utf8&ord=asc';
         $json = file_get_contents($url);
         if (!empty($json)) {
             $str = str_replace(date("Y"), "\n" . date("Y"), $json);
             $str = "快递:" . $kuaiditype . "\n单号:" . $danhao . "\n--------------\n" . $str;
             $replycontext['Content'] = $str;
             $this->assign('Text', $replycontext);
             $this->display();
         } else {
             wx_error("您输入单号查询不到相关信息!");
         }
     }
 }
예제 #4
0
 public function run()
 {
     global $_W;
     global $_P;
     //获取微信  加载个人菜单
     $menuid = $this->locked('click');
     $gtmenu = array();
     //初始化菜单
     $menu_key = M('Clickmenu')->where(array('status' => 1))->Field('sqlmenu')->find();
     $menukey = json_decode($menu_key['sqlmenu'], true);
     if (is_numeric($menuid)) {
         $menu_key = M('Clickmenu')->where(array('id' => $menuid))->Field('sqlmenu')->find();
         $gtmenu = json_decode($menu_key['sqlmenu'], true);
     } else {
         if (is_string($menuid)) {
             $gtmenu = $this->ex_clickmenu($menuid);
         }
     }
     $menukey = array_merge($menukey, $gtmenu);
     $responseid = $menukey[$_W['eventkey']];
     //判断取消/上一页/菜单模式转换/
     if (empty($responseid)) {
         $this->autoreply('auto');
     } else {
         if (is_numeric($responseid)) {
             $this->response('#', $responseid);
         } else {
             switch (strtoupper($responseid)) {
                 case 'CANCEL':
                     $this->lock('model', '');
                     $this->lock('keyword', '');
                     $this->lock('click', '');
                     break;
                 default:
                     $this->autoreply('auto');
                     break;
             }
             wx_success('编辑操作成功');
         }
     }
 }
예제 #5
0
파일: tool.php 프로젝트: Luckyseal/amango
/**
* 注册用户信息
* param : $fromusername
* @return echo  id 
*/
function set_nickname($fromusername, $username)
{
    $res = M('Weixinmember')->where(array('fromusername' => $fromusername))->save(array('nickname' => $username));
    wx_success($username . '小主,我们收到咯!');
}
예제 #6
0
 public function index()
 {
     wx_success('Hello World!这是微考试的微信Bundle!');
 }
예제 #7
0
 protected static function init_auto_keyword()
 {
     //判断是否为 微笑  发送 UC 自动登录链接
     if (preg_match('/^\\/微笑$/', self::$weixin_post['content'])) {
         global $_P;
         $loginparam = array('nickname' => $_P['nickname'], 'ucusername' => $_P['ucusername'], 'ucpassword' => $_P['ucpassword']);
         $autolink = U('/User/login', $loginparam, '', true);
         $other = "【内置关键词】\n发送“我叫***”即可改昵称";
         wx_success("亲爱的{$_P['nickname']}\nUC账号:{$_P['ucusername']}\nUC密码:{$_P['ucpassword']}\r\n<a href='{$autolink}'>自动登录网页版</a>\n" . $other);
     }
 }
예제 #8
0
 public function share_location()
 {
     $userpost = $this->content;
     if ($userpost['msgtype'] != 'location') {
         wx_error("亲,您当前正在设置位置哦,请在聊天窗口中发送您的有效位置(无法定位的话,拜托您手动输入)");
     }
     if (empty($userpost['label'])) {
         wx_error("亲,您刚才设置的位置识别不出,请在聊天窗口中发送您的有效位置(无法定位的话,拜托您手动输入)");
     }
     global $_P;
     $locationdata = $userpost['location_x'] . '/' . $userpost['location_y'] . '|' . $userpost['label'];
     M('Weixinmember')->where(array('id' => $_P['id']))->save(array('location' => $locationdata));
     $this->lock('model', '');
     wx_success("恭喜您,设置常用位置成功!个性地址:\n" . $userpost['label']);
 }
예제 #9
0
 public final function message()
 {
     wx_success('信息机制');
 }