public function suggest()
 {
     $config = getAddonConfig('Suggestions');
     if (IS_AJAX) {
         // 保存用户信息
         $nickname = I('nickname');
         if ($config['need_nickname'] && !empty($nickname)) {
             $data['nickname'] = $nickname;
         }
         $mobile = I('mobile');
         if ($config['need_mobile'] && !empty($mobile)) {
             $data['mobile'] = $mobile;
         }
         // 保存内容
         $data['cTime'] = time();
         $data['content'] = I('content');
         $data['token'] = get_token();
         $res = M('suggestions')->add($data);
         if ($res) {
             // 增加积分
             add_credit('suggestions');
             $data['status'] = 1;
             $data['info'] = '反馈成功,感谢您的支持~';
             //$this->success ( '增加成功,谢谢您的反馈' );
             $openid = getOpenidByUid($config['admin_id']);
             $kf_data['touser'] = $openid;
             $kf_data['msgtype'] = 'text';
             $kf_data['text']['content'] = "新的反馈内容:" . $data['content'];
             //replyText(json_encode($kf_data));
             sendCustomMessage($kf_data);
         } else {
             $data['status'] = 0;
             $data['info'] = '反馈失败,请重新提交反馈内容~';
             //$this->error ( '增加失败,请稍后再试' );
         }
         $this->ajaxReturn($data);
     } else {
         $this->assign($config);
         // dump ( $config );
         $user = getUserInfo(get_mid());
         $this->assign('user', $user);
         $this->display();
     }
 }
 public function payok()
 {
     $data['token'] = get_token();
     $data['openid'] = get_openid();
     $data['money'] = I('price');
     $data['ctime'] = time();
     $data['email'] = I('email');
     $data['content'] = I('content');
     $data['is_anonymous'] = intval(I('is_anonymous'));
     $wexinUserInfo = getWeixinUserInfo(get_openid(), get_token());
     $data['nickname'] = $wexinUserInfo['nickname'] ? $wexinUserInfo['nickname'] : '匿名';
     $res = M('donations_list')->add($data);
     if ($res) {
         // 给管理员发送通知
         $config = getAddonConfig('Donations');
         foreach ($config['admins'] as $k => $v) {
             $kf_data['touser'] = getOpenidByUid($v);
             $kf_data['msgtype'] = 'text';
             $kf_data['text']['content'] = '用户' . $data['nickname'] . '捐赠了' . $data['money'] . '元并附言:' . $data['content'];
             sendCustomMessage($kf_data);
         }
         echo json_encode($data);
     }
 }