Exemplo n.º 1
0
 /**
  * 365日期属性 可选择日期 接口
  * @auth song
  * @param int $month
  *
  * @return json
  * */
 public function actionChoicedate()
 {
     if (PublicLibrary::is_ajax()) {
         $month = Yii::$app->request->post('month');
         $mactpro = new ActivityProduct();
         $monthproductlist = $mactpro->getMonthlist($month);
         if ($monthproductlist) {
             foreach ($monthproductlist as $key => $val) {
                 $stime = date('Y-m-d', $val['start_time']);
                 $mlpro[] = $stime;
             }
             echo PublicLibrary::format_res_encode('0', 'success', $mlpro);
         } else {
             echo PublicLibrary::format_res_encode('1002', 'search error');
         }
     } else {
         echo PublicLibrary::format_res_encode('1001', 'requst error');
     }
 }
Exemplo n.º 2
0
 /**
  * [解除绑定 接口]
  * @author song
  * @param int $thirdtype 解绑类型
  * @return json
  */
 public function actionOutBindin()
 {
     if (PublicLibrary::is_ajax()) {
         //判断登陆
         if (PublicLibrary::is_login()) {
             $user = PublicLibrary::is_login();
             $thirdtype = Yii::$app->request->post('thirdtype');
             if ($thirdtype) {
                 $LoginThird_model = new LoginThird();
                 $query = $LoginThird_model->find()->where(['uid' => $user['uid'], 'thirdtype' => $thirdtype]);
                 $query->keystatus = 1;
                 if ($query->save()) {
                     $res = PublicLibrary::format_res_encode('0', '成功!');
                 } else {
                     $res = PublicLibrary::format_res_encode('1', '失败!');
                 }
             } else {
                 $res = PublicLibrary::format_res_encode('2', '参数有误!');
             }
         } else {
             $res = PublicLibrary::format_res_encode('3', '未登录!');
         }
         echo $res;
     }
 }
Exemplo n.º 3
0
 /**
  * 找回密码 第三步   邮箱跳转回来地址,设置密码页!
  * @param str $from = email 标识
  * @param str $msg 加密的用户信息
  *
  * @return 跳转
  */
 public function actionEmailPrompt()
 {
     //邮箱跳转回来地址
     $from = Yii::$app->request->get('from');
     if (Yii::$app->request->get('from') == 'email') {
         $msg = Yii::$app->request->get('msg');
         if (empty($msg)) {
             echo "<script>alert('地址有误!'),window.location.href='" . Url::toRoute('user/find-password') . "';</script>";
             exit;
         }
         $content = PublicLibrary::pwfindUrl($msg, true);
         $Member_model = new Member();
         $userone = $Member_model->getByUserName($content['username']);
         $now = time();
         if ($userone['password'] == $content['password'] && $content['outtime'] > $now) {
             $checkkey = PublicLibrary::setKey();
             if (PublicLibrary::is_ajax()) {
                 $this->layout = false;
                 echo $this->render('ajax_setpassword', ['checkkey' => $checkkey, 'username' => $content['username'], 'from' => 'email']);
                 exit;
             } else {
                 return $this->render('setpassword', ['checkkey' => $checkkey, 'username' => $content['username'], 'from' => 'email']);
                 exit;
             }
         } else {
             echo "<script>alert('验证链接已过期,请重新操作!'),window.location.href='" . Url::toRoute('user/find-password') . "';</script>";
         }
     }
 }
Exemplo n.º 4
0
 /**
  * @author song
  * 提屁股 成功修改状态接口
  * @param int  $supportid 支持人id
  * @param int $supnum 踢屁股次数
  *
  * @return json
  * */
 public function actionGamesuccess()
 {
     //判断登陆
     $user = PublicLibrary::is_login();
     if ($user && $user['uid'] != 'weixin' && PublicLibrary::is_ajax()) {
         $date = Yii::$app->request->post();
         $supportid = isset($date['supportid']) ? intval($date['supportid']) : 0;
         $supnum = isset($date['supnum']) ? intval($date['supnum']) : 0;
         $msupport = new BaiyingSupport();
         $supportone = $msupport->pk($supportid);
         if ($supportone && $supportone['support_status'] == BaiyingSupport::SUPPORT_STATUS_DEF) {
             if ($supnum > BaiyingSupport::SUPPORT_STATAR) {
                 $mshare = new BaiyingShare();
                 //查询分享人uid
                 $oldres = $mshare->pk($supportone['shareid']);
                 $rel_id = $oldres['rel_id'];
                 //判断活动状态
                 $mactpro = new ActivityProduct();
                 $productattr = $mactpro->getDetailBypk($rel_id);
                 if ($productattr['status'] != ActivityProduct::STATUS_VERIFY_THROUGH) {
                     echo "<script>alert('活动已结束!'),window.location.href='/baiying/userproduct';</script>";
                     exit;
                 }
                 //查询该分享人所有的分享列表
                 $sharelist = $mshare->getSharelistByuid('', $oldres['uid'], ActivityBase::APPLY_BAIYING);
                 foreach ($sharelist as $key => $val) {
                     $sarr[] = $val['id'];
                 }
                 //查询当前用户支持成功的 记录
                 $usersuplist = $msupport->getSupportlist('', $user['uid'], BaiyingSupport::SUPPORT_STATUS_SUCCE);
                 foreach ($usersuplist as $key => $val) {
                     $uresanduser = $mshare->pk($val['shareid']);
                     //当前用户支持的产品的发布用户 等于 要支持订单的发布者
                     if ($uresanduser['uid'] == $oldres['uid']) {
                         $uarr[] = $val['shareid'];
                     }
                 }
                 if (isset($sarr) && isset($uarr)) {
                     $insec = array_intersect($sarr, $uarr);
                 }
                 //                $cc = isset($insec)?$insec:'1';
                 //                echo '<pre>';
                 //                print_r($cc);
                 if (isset($insec) && is_array($insec)) {
                 } else {
                     //增加分享支持统计数
                     $shafu = $mshare->addSharenum($supportone['shareid']);
                 }
                 $shareone = $mshare->pk($supportone['shareid']);
                 //支持数大于标准(30),且状态为1 修改支付状态
                 if ($shareone['share_num'] >= BaiyingShare::SHARE_STANDARD && $shareone['share_status'] == BaiyingShare::SHARE_STATUS_DEF) {
                     $sharecontent['id'] = $supportone['shareid'];
                     //商品剩余不足 状态修改成 售罄
                     //支付成功的分享
                     $succnum = $mshare->getcountnum($shareone['rel_id'], BaiyingShare::SHARE_STATUS_PAY);
                     //商品属性
                     $mapattrval = new ActivityProductAttrVal();
                     $acprattr = $mapattrval->getRealAttrVals($shareone['rel_id'], ActivityBase::APPLY_BAIYING);
                     if ($succnum >= $acprattr['supply_num']['attr_val']) {
                         $sharecontent['share_status'] = BaiyingShare::SHARE_OUT;
                     } else {
                         $sharecontent['share_status'] = BaiyingShare::SHARE_STATUS_SUCCE;
                     }
                     $res = $mshare->store($sharecontent);
                 }
                 $upcontent['support_status'] = BaiyingSupport::SUPPORT_STATUS_SUCCE;
             }
             //更新支持提屁股次数和 状态
             $upcontent['id'] = $supportid;
             $upcontent['uid'] = isset($user['uid']) ? $user['uid'] : '';
             $upcontent['mobile'] = isset($user['mobile']) ? $user['mobile'] : '';
             if ($supnum > $supportone['sup_num']) {
                 $upcontent['sup_num'] = $supnum;
             }
             $supfu = $msupport->store($upcontent);
             if ($supfu) {
                 echo PublicLibrary::format_res_encode('0', 'success', 'f**k');
             } else {
                 echo PublicLibrary::format_res_encode('1001', 'save error!');
             }
         } else {
             $upcontent['id'] = $supportid;
             if ($supnum > $supportone['sup_num']) {
                 $upcontent['sup_num'] = $supnum;
             }
             $upcontent['support_status'] = BaiyingSupport::SUPPORT_STATUS_SUCCE;
             $supfu = $msupport->store($upcontent);
             if ($supfu) {
                 echo PublicLibrary::format_res_encode('01', 'supnum up success!');
             } else {
                 echo PublicLibrary::format_res_encode('1003', 'supnum up error!');
             }
         }
     } else {
         echo PublicLibrary::format_res_encode('1001', 'the user no login or no ajax!');
         exit;
     }
 }
Exemplo n.º 5
0
 /**
  * 删除商品
  *
  * @param int $id 产品id号
  * @return string $result
  * [
  *     'code'=>   0 成功            1001 失败
  *     'msg'=>    '产品删除成功'     '产品删除成功'
  *     'data'=>[],
  * ]
  *
  */
 public function actionDel()
 {
     $id = Yii::$app->request->post('id');
     //必须是Ajax
     if (!PublicLibrary::is_ajax() || !isset($id)) {
         echo PublicLibrary::format_res_encode('1002', '不是Ajax 或不是post请求');
         exit;
     } else {
         if (!PublicLibrary::is_login()) {
             echo PublicLibrary::format_res_encode('1004', '没登陆');
             exit;
         }
     }
     $user = PublicLibrary::is_login();
     //是否是该用户的产品
     $mIProductBase = new IProductBase();
     $id = intval($id);
     if (!$mIProductBase->isMyProduct($user['uid'], $id)) {
         echo PublicLibrary::format_res_encode('1003', '非法操作');
         exit;
     }
     $del = $this->findModel($id);
     if ($del['status'] != IProductBase::STATUS_FIRST) {
         $del->status = 0;
         if ($del->save()) {
             //发布成功后更新用户统计表
             $session = Yii::$app->session;
             $session->isActive ? '' : $session->open();
             $MemberStat = new MemberStat();
             $MemberStat->decr($session['user']['uid'], 'product_num');
             $res = $MemberStat->getByUid($session['user']['uid']);
             $num = $res['product_num'];
             $resutl = ['code' => 0, 'msg' => '产品删除成功1', 'data' => $num];
         } else {
             $resutl = ['code' => 1001, 'msg' => '产品删除失败', 'data' => []];
         }
     } else {
         $del->status = 0;
         if ($del->save()) {
             //发布成功后更新用户统计表
             $session = Yii::$app->session;
             $session->isActive ? '' : $session->open();
             $MemberStat = new MemberStat();
             $res = $MemberStat->getByUid($session['user']['uid']);
             $num = $res['product_num'];
             $resutl = ['code' => 0, 'msg' => '产品删除成功2', 'data' => $num];
         } else {
             $resutl = ['code' => 1001, 'msg' => '产品删除失败', 'data' => []];
         }
     }
     return json_encode($resutl);
 }
Exemplo n.º 6
0
 /**
  * 收货地址接口
  * @param str $harvest 收获姓名
  * @param str $telephone 电话
  *
  * @param json
  * */
 public function actionAddress()
 {
     $user = PublicLibrary::is_login();
     if (isset($user['uid']) && PublicLibrary::is_ajax()) {
         $uid = $user['uid'];
     } else {
         echo PublicLibrary::format_res_encode('1001', 'login or ajax error');
         exit;
     }
     //$uid = 11;
     $date = Yii::$app->request->post();
     $date = array_map('trim', $date);
     $date = array_map('strip_tags', $date);
     $date = array_map('htmlspecialchars', $date);
     if (empty($date)) {
         echo PublicLibrary::format_res_encode('1002', 'param error');
         exit;
     }
     $date['uid'] = $uid;
     $mharaddr = new HarvestAddress();
     $return = $mharaddr->store($date);
     if ($return) {
         echo PublicLibrary::format_res_encode('0', 'success', $return);
         exit;
     } else {
         echo PublicLibrary::format_res_encode('1003', 'save error');
         exit;
     }
 }