public function actionGet()
 {
     //        var data = {
     //            "title": "资产主管Assets Supervisor",
     //                    "id": "04189",
     //                    "obj": "全职111",
     //                    "add": "天津市",
     //                    "order": "1",
     //                    "money": "面谈",
     //                    "date": "2015-05-05",
     //                    "type": "社招",
     //                    "item": "支持中心岗位",
     //                    "intro": "本职位对橙汁先生的贡献在于:代表公司与业主进行沟通和对合同及业主关系进行管理确保我们的资产合法顺利有效经营本职位对橙汁先生的贡献在于:代表公司与业主进行沟通和对合同及业主关系进行管理确保我们的资产合法本职位对橙汁先生的贡献在于:代表公司与业主进行沟通和对合同及业主关系进行管理确保我们的资产合法顺利有效经营本职位对橙汁先生的贡献在于:代表公司与业主进行沟通和对合同及业主关系进行管理确保我们的资产合法"
     //
     //                };
     $id = \Yii::$app->request->post('id');
     if (!$id) {
         JsonParser::GenerateJsonResult('_0001', '无数据');
         exit;
     }
     $model = Employ::findOne($id);
     $g = $model->group ? $model->group : 2;
     $g = GlobalArray::$employGroupArr[$g];
     $t = $model->type ? $model->type : 2;
     $t = GlobalArray::$employTypeArr[$t];
     $s = $model->status ? $model->status : 0;
     $s = GlobalArray::$employStatusArr[$s];
     $data = [];
     $data = ["title" => $model->employName, "id" => $model->id, "obj" => $g, "add" => $model->address, "order" => $model->count, "money" => $model->money, "date" => date('Y-m-d', strtotime($model->publishTime)), "type" => $t, "item" => $model->category, "intro" => $model->description, "email" => $model->sendEmail];
     echo json_encode($data);
     exit;
 }
 public function actionPublishcoment()
 {
     $userId = Yii::$app->session->get(FVariable::$session_userId_str);
     if (!$userId) {
         JsonParser::GenerateJsonResult('_0004', '您还没登录,请登录再发表看法');
         exit;
     }
     $ArticleCon = Yii::$app->request->post("ArticleCon");
     if (!$ArticleCon) {
         JsonParser::GenerateJsonResult('_0003', '发表的内容不能为空');
         exit;
     }
     $ArticleId = Yii::$app->request->post("ArticleId");
     $article = new Article();
     $articleCon = $article->findByArticleId($ArticleId);
     if (!$articleCon) {
         return $this->redirect(FVariable::$error404_view);
     }
     $comment = new Comment();
     $comment->findByIdArticleInsert($userId, 0, $ArticleId, $ArticleCon);
     JsonParser::GenerateJsonResult('_0000', '发表成功');
     exit;
 }
 public function actionApply()
 {
     $req = \Yii::$app->request;
     $username = trim($req->post('username'));
     $mobile = trim($req->post('mobile'));
     $company = trim($req->post('company'));
     $industry = trim($req->post('industry'));
     $email = trim($req->post('email'));
     $nature = trim($req->post('nature'));
     $inCity = trim($req->post('inCity'));
     $area = trim($req->post('area'));
     $inMoney = trim($req->post('inMoney'));
     $inCount = trim($req->post('inCount'));
     $inPlace = trim($req->post('inPlace'));
     $hardwareSource = trim($req->post('hardwareSource'));
     $experience = trim($req->post('experience'));
     $inSource = trim($req->post('inSource'));
     if ((new Join())->addOneJoin($username, $mobile, $company, $industry, $email, $nature, $inCity, $area, $inMoney, $inCount, $inPlace, $hardwareSource, $experience, $inSource)) {
         JsonParser::GenerateJsonResult('_0000', '感谢您的申请,我们会尽快联系您的');
         exit;
     }
     JsonParser::GenerateJsonResult('_0001', '申请提交失败,请刷新重试');
     exit;
 }
 public function actionDeleteactivity()
 {
     $actId = trim(Yii::$app->request->post('actId'));
     if (!isset($actId) || empty($actId)) {
         JsonParser::GenerateJsonResult('_0001', 'ID不能为空');
         exit;
     }
     $isDelete = (new Activity())->deleteActivity($actId);
     if ($isDelete) {
         JsonParser::GenerateJsonResult('_0000', '删除成功');
         exit;
     }
     JsonParser::GenerateJsonResult('_0002', '删除失败,请刷新重试');
     exit;
 }
 public function actionFindpswcode()
 {
     $phoneNumber = Yii::$app->request->post('phoneNumber');
     if (!preg_match("/^1[3-5,7-8]{1}[0-9]{9}\$/", $phoneNumber)) {
         exit;
     }
     $user = new User();
     $userMoblie = $user->findUserByUserName($phoneNumber);
     if (!$userMoblie) {
         JsonParser::GenerateJsonResult('_0004', '*手机号码不存在!');
         exit;
     }
     if (Tool::sendSms(Variable::$smsType_findPassword, $phoneNumber) == true) {
         JsonParser::GenerateJsonResult('_0000', '发送成功');
         exit;
     }
 }
 public function actionDeleteuser()
 {
     $userId = trim(Yii::$app->request->post('userId'));
     if (!isset($userId) || empty($userId)) {
         JsonParser::GenerateJsonResult('_0001', '用户ID不能为空');
         exit;
     }
     $isDelete = (new User())->deleteUser($userId);
     if ($isDelete) {
         JsonParser::GenerateJsonResult('_0000', '用户删除成功');
         exit;
     }
     JsonParser::GenerateJsonResult('_0002', '用户删除失败,请刷新重试');
     exit;
 }
 public function actionUpdatebar()
 {
     $barId = trim(Yii::$app->request->post('barId'));
     $name = trim(Yii::$app->request->post('name'));
     $link = trim(Yii::$app->request->post('link'));
     if (!isset($name) || empty($name)) {
         JsonParser::GenerateJsonResult('_0001', '栏目名称不能为空');
         exit;
     }
     $isSuccess = (new Bar())->updateBar($barId, $name, $link);
     if ($isSuccess) {
         JsonParser::GenerateJsonResult('_0000', '更新成功');
         exit;
     }
     JsonParser::GenerateJsonResult('_0002', '更新失败,请刷新重试');
     exit;
 }
 public function actionDeletearticle()
 {
     $id = trim(Yii::$app->request->post('id'));
     if (!isset($id) || empty($id)) {
         JsonParser::GenerateJsonResult('_0001', '文章ID不能为空');
         exit;
     }
     $isDelete = (new Article())->deleteArticle($id);
     if ($isDelete) {
         JsonParser::GenerateJsonResult('_0000', '文章删除成功');
         exit;
     }
     JsonParser::GenerateJsonResult('_0002', '文章删除失败,请刷新重试');
     exit;
 }
 public function actionUploadnetvideo()
 {
     $videoLink = trim(Yii::$app->request->post('videoLink'));
     if (!isset($videoLink) || empty($videoLink)) {
         JsonParser::GenerateJsonResult('_0001', '不合法的视频链接');
         exit;
     }
     $ss = 'video/';
     if (!strpos($videoLink, $ss)) {
         $ch = curl_init();
         curl_setopt($ch, CURLOPT_URL, $videoLink);
         //不下载
         curl_setopt($ch, CURLOPT_NOBODY, 1);
         //设置超时
         curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 3);
         curl_setopt($ch, CURLOPT_TIMEOUT, 3);
         curl_exec($ch);
         $http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
         if ($http_code == 200) {
             $model = Material::find()->where(['materialId' => Variable::$materialId_productVideo])->one();
             if ($model) {
                 $model->address = $videoLink;
                 if ($model->save()) {
                     JsonParser::GenerateJsonResult('_0000', '上传成功');
                     exit;
                 }
             } else {
                 $model = new Material();
                 $model->type = 2;
                 $model->materialId = Variable::$materialId_productVideo;
                 $model->address = $videoLink;
                 if ($model->save()) {
                     JsonParser::GenerateJsonResult('_0000', '上传成功');
                     exit;
                 }
             }
         }
         JsonParser::GenerateJsonResult('_0001', '不合法的视频链接');
         exit;
     }
     JsonParser::GenerateJsonResult('_0000', '上传成功');
     exit;
 }
 public function actionHasdelivery()
 {
     $userId = Yii::$app->session->get(FVariable::$session_userId_str);
     if (!$userId) {
         return $this->redirect(FVariable::$siteLogin_view);
     }
     $orderId = Yii::$app->request->post('orderId');
     $order = new Order();
     $orderUpdate = $order->findByHasDelivery($orderId, $userId);
     JsonParser::GenerateJsonResult('_0000', '确认收货成功!');
     exit;
 }
 public function actionAddproductcat()
 {
     $user = new AdminUser();
     if (!$user->checkUserIsLogin()) {
         $this->redirect(Variable::$home_url);
         return;
     }
     //请求处理
     $req = Yii::$app->request;
     $name = trim($req->post('name'));
     $sort = trim($req->post('sort'));
     $desc = trim($req->post('desc'));
     if ((new ProductCategory())->addCat($name, $sort, $desc)) {
         JsonParser::GenerateJsonResult('_0000', '添加成功');
         exit;
     }
     JsonParser::GenerateJsonResult('_0001', '添加失败');
     exit;
 }
 public function actionUpdatecus()
 {
     $id = trim(Yii::$app->request->post('id'));
     $parentId = trim(Yii::$app->request->post('parentId'));
     $name = trim(Yii::$app->request->post('name'));
     $sort = trim(Yii::$app->request->post('sort'));
     $level = trim(Yii::$app->request->post('level'));
     $clogo = null;
     $blogo = null;
     if (!isset($name) || empty($name)) {
         JsonParser::GenerateJsonResult('_0001', '名称不能为空');
         exit;
     }
     $isSuccess = (new Customer())->updateCus($id, $name, $sort, $level, $blogo, $clogo);
     if ($isSuccess) {
         JsonParser::GenerateJsonResult('_0000', '更新成功');
         exit;
     }
     JsonParser::GenerateJsonResult('_0002', '更新失败,请刷新重试');
     exit;
 }