Пример #1
0
 public function messagestate()
 {
     $message['cus_id'] = Auth::id();
     $message['id'] = Input::get('id');
     $postFun = new CommonController();
     $a = Input::get('status');
     if (Input::get('status') == NULL) {
         echo $postFun->postsend("http://swap.5067.org/admin/del.php", $message);
     } else {
         $message['status'] = Input::post('status');
         echo $postFun->postsend("http://swap.5067.org/admin/status.php", $message);
     }
 }
Пример #2
0
 public function getmessageboard()
 {
     $message['cus_id'] = Auth::id();
     $message['page'] = Input::get('page');
     $message['per_page'] = Input::get('per_page');
     $postFun = new CommonController();
     echo $postFun->postsend("http://www.message.com/message/list.php", $message);
 }
Пример #3
0
 public function getCount()
 {
     $cus_id = Auth::id();
     $param['cus_id'] = $cus_id;
     $postFun = new CommonController();
     $res2 = $postFun->postsend("http://swap.5067.org/admin/statis_admin.php", $param);
     $data = json_decode($res2);
     if ($data != NULL) {
         $res = Response::json(['err' => 0, 'msg' => '获取统计数据成功', 'data' => $data]);
     } else {
         $res = Response::json(['err' => 1, 'msg' => '获取统计数据失败', 'data' => null]);
     }
     return $res;
 }
Пример #4
0
 public function sendCusAllData($url = '')
 {
     $id = $this->cus_id;
     $type = $this->type;
     $string = $this->searchPreview();
     if ($string) {
         $file_arr = $this->getFile(app_path('views/templates/' . $this->themename));
         $file_name = "";
         $file_content = "";
         foreach ($file_arr as &$file) {
             if (preg_match('/^_.*/i', $file) || $file == 'searchresult.html') {
                 $file_name .= $file . '@';
                 $file_content .= file_get_contents(app_path('views/templates/' . $this->themename . '/' . $file)) . '@#@';
             }
         }
         $file_name = rtrim($file_name, '@');
         $file_content = rtrim($file_content, '@#@');
         $postFun = new CommonController();
         $postFun->postsend($url, array("id" => $id, 'type' => $type, 'string' => $string, 'file_name' => $file_name, 'file_content' => $file_content));
     }
 }
Пример #5
0
 /**
  * 删除用户数据
  */
 public function deleteFormUserdata()
 {
     $form_id = Input::get('form_id');
     $id = Input::get('id');
     $param['form_id'] = $form_id;
     $param['id'] = $id;
     $param['flag'] = 1;
     $param['host'] = $_SERVER['HTTP_HOST'];
     Classify::where('form_id', $form_id)->update(['pushed' => 1]);
     //		$res = DB::table('form_data_' . $form_id % 10)->where('id', $id)->delete();
     $postFun = new CommonController();
     $res = $postFun->postsend("http://swap.5067.org/admin/form_userdata_delete.php", $param);
     if ($res == 1) {
         $json = Response::json(['err' => 0, 'msg' => '删除成功', 'data' => $res]);
     } else {
         $json = Response::json(['err' => 1, 'msg' => '删除失败', 'data' => '']);
     }
     return $json;
 }
Пример #6
0
 /**
  * 创建用户    modifyCustomer
  * @param type name             用户名
  * @param type email            用户邮箱
  * @param type ftp_address      ftp地址
  * @param type ftp_user         ftp帐号
  * @param type ftp_pwd          ftp密码
  * @param type ended_at         用户终止时间
  * @param type status           用户状态
  * @return type data            用户id
  */
 public function modifyCustomer()
 {
     if ($this->authData()) {
         $update['name'] = trim(Input::get('name'));
         $update['email'] = trim(Input::get('email'));
         $update['weburl'] = trim(Input::get('weburl'));
         $update['pc_domain'] = trim(Input::get('pc_domain'));
         $update['mobile_domain'] = trim(Input::get('mobile_domain'));
         if (trim(Input::get('pc_tpl_id')) == '0') {
             $update['pc_tpl_num'] = 1;
         } else {
             $update['pc_tpl_num'] = trim(Input::get('pc_tpl_id'));
         }
         if (trim(Input::get('mobile_tpl_id')) == '0') {
             $update['mobile_tpl_num'] = 1;
         } else {
             $update['mobile_tpl_num'] = trim(Input::get('mobile_tpl_id'));
         }
         $update['stage'] = trim(Input::get('stage'));
         $update['ftp'] = trim(Input::get('ftp'));
         $update['ftp_port'] = trim(Input::get('ftp_port'));
         $update['ftp_dir'] = trim(Input::get('ftp_dir'));
         $update['ftp_address'] = trim(Input::get('ftp_address'));
         $update['ftp_user'] = trim(Input::get('ftp_user'));
         $update['ftp_pwd'] = trim(Input::get('ftp_pwd'));
         $update['ended_at'] = trim(Input::get('ended_at'));
         $update['status'] = Input::get('status');
         $update['customization'] = Input::get('customization');
         //===绑定账户===
         $switch_cus_name = Input::get('switch_cus_name');
         if (!empty($switch_cus_name)) {
             $update['switch_cus_id'] = Customer::where('name', $switch_cus_name)->pluck('id');
         } else {
             $update['switch_cus_id'] = 0;
         }
         //===end===
         //===不能用update数组,因为Customer表中没有capacity/capacity_use字段===
         $capacity = Input::get('capacity') ? trim(Input::get('capacity')) : 300 * 1024 * 1024;
         //默认100MB
         $cus_id = Customer::where('name', $update['name'])->pluck('id');
         if ($cus_id) {
             //修改操作
             $coustomer_old = Customer::where('id', $cus_id)->first();
             $save = Customer::where('id', $cus_id)->update($update);
             $pc_id = Template::where('tpl_num', $update['pc_tpl_num'])->where('type', 1)->pluck('id');
             $mobile_id = Template::where('tpl_num', $update['mobile_tpl_num'])->where('type', 2)->pluck('id');
             $pc_templateid = Template::where('cus_id', $cus_id)->where('type', 1)->pluck('id');
             $mobile_templateid = Template::where('cus_id', $cus_id)->where('type', 2)->pluck('id');
             if ($pc_templateid != NULL) {
                 WebsiteInfo::where('cus_id', $cus_id)->update(['pc_tpl_id' => $pc_templateid]);
             } else {
                 WebsiteInfo::where('cus_id', $cus_id)->update(['pc_tpl_id' => $pc_id]);
             }
             if ($mobile_templateid != NULL) {
                 WebsiteInfo::where('cus_id', $cus_id)->update(['mobile_tpl_id' => $mobile_templateid]);
             } else {
                 WebsiteInfo::where('cus_id', $cus_id)->update(['mobile_tpl_id' => $mobile_id]);
             }
             //WebsiteInfo::where('cus_id',$cus_id)->update(['pc_tpl_id'=>$pc_id,'mobile_tpl_id'=>$mobile_id]);
             //===更新CustomerInfo时,更新capacity字段===
             CustomerInfo::where('cus_id', $cus_id)->update(['pc_domain' => $update['pc_domain'], 'mobile_domain' => $update['mobile_domain'], 'capacity' => $capacity]);
             if ($update['stage'] != $coustomer_old['stage'] or $update['pc_domain'] != $coustomer_old['pc_domain'] or $update['mobile_domain'] != $coustomer_old['mobile_domain']) {
                 $common = new CommonController();
                 @$common->postsend(trim($update['weburl'], '/') . "/urlbind.php", array('cus_name' => $update['name'], 'stage' => $update['stage'], 'pc_domain' => $update['pc_domain'], 'mobile_domain' => $update['mobile_domain'], 'stage_old' => $coustomer_old['stage'], 'pc_domain_old' => $coustomer_old['pc_domain'], 'mobile_domain_old' => $coustomer_old['mobile_domain']));
             }
             if ($save) {
                 $result = ['err' => 1000, 'msg' => '更新用户成功'];
             } else {
                 $result = ['err' => 1002, 'msg' => '更新用户失败'];
             }
         } else {
             //增加操作
             $update['password'] = Hash::make($update['name']);
             $insert_id = Customer::insertGetId($update);
             if ($insert_id) {
                 $pc_id = Template::where('tpl_num', $update['pc_tpl_num'])->where('type', 1)->pluck('id');
                 $mobile_id = Template::where('tpl_num', $update['mobile_tpl_num'])->where('type', 2)->pluck('id');
                 WebsiteInfo::insert(['cus_id' => $insert_id, 'pc_tpl_id' => $pc_id, 'mobile_tpl_id' => $mobile_id]);
                 CustomerInfo::insert(['cus_id' => $insert_id, 'pc_domain' => $update['pc_domain'], 'mobile_domain' => $update['mobile_domain'], 'capacity' => $capacity, 'capacity_use' => 0]);
                 //创建客户目录
                 mkdir(public_path('customers/' . $update['name']));
                 mkdir(public_path('customers/' . $update['name']) . '/detail');
                 mkdir(public_path('customers/' . $update['name']) . '/category');
                 mkdir(public_path('customers/' . $update['name']) . '/images');
                 mkdir(public_path('customers/' . $update['name']) . '/images/l');
                 mkdir(public_path('customers/' . $update['name']) . '/images/l/category');
                 mkdir(public_path('customers/' . $update['name']) . '/images/l/articles');
                 mkdir(public_path('customers/' . $update['name']) . '/images/l/common');
                 mkdir(public_path('customers/' . $update['name']) . '/images/l/page_index');
                 mkdir(public_path('customers/' . $update['name']) . '/images/s');
                 mkdir(public_path('customers/' . $update['name']) . '/images/s/category');
                 mkdir(public_path('customers/' . $update['name']) . '/images/s/articles');
                 mkdir(public_path('customers/' . $update['name']) . '/images/s/common');
                 mkdir(public_path('customers/' . $update['name']) . '/images/s/page_index');
                 mkdir(public_path('customers/' . $update['name']) . '/images/ueditor');
                 mkdir(public_path('customers/' . $update['name']) . '/mobile');
                 mkdir(public_path('customers/' . $update['name']) . '/mobile/detail');
                 mkdir(public_path('customers/' . $update['name']) . '/mobile/category');
                 mkdir(public_path('customers/' . $update['name']) . '/mobile/images');
                 mkdir(public_path('customers/' . $update['name']) . '/mobile/images/l');
                 mkdir(public_path('customers/' . $update['name']) . '/mobile/images/l/category');
                 mkdir(public_path('customers/' . $update['name']) . '/mobile/images/l/articles');
                 mkdir(public_path('customers/' . $update['name']) . '/mobile/images/l/common');
                 mkdir(public_path('customers/' . $update['name']) . '/mobile/images/l/page_index');
                 mkdir(public_path('customers/' . $update['name']) . '/mobile/images/s');
                 mkdir(public_path('customers/' . $update['name']) . '/mobile/images/s/category');
                 mkdir(public_path('customers/' . $update['name']) . '/mobile/images/s/articles');
                 mkdir(public_path('customers/' . $update['name']) . '/mobile/images/s/common');
                 mkdir(public_path('customers/' . $update['name']) . '/mobile/images/s/page_index');
                 mkdir(public_path('customers/' . $update['name']) . '/mobile/images/ueditor');
                 $ftp_array = explode(':', $update['ftp_address']);
                 $port = $update['ftp_port'];
                 $ftp_array[1] = isset($ftp_array[1]) ? $ftp_array[1] : $port;
                 $conn = ftp_connect($ftp_array[0], $ftp_array[1]);
                 if ($conn) {
                     if (trim(Input::get('ftp')) == '1') {
                         ftp_login($conn, $update['ftp_user'], $update['ftp_pwd']);
                         ftp_mkdir($conn, $update['name']);
                         ftp_mkdir($conn, $update['name'] . '/images');
                         ftp_mkdir($conn, $update['name'] . '/detail');
                         ftp_mkdir($conn, $update['name'] . '/category');
                         ftp_mkdir($conn, $update['name'] . '/images/ueditor');
                         ftp_mkdir($conn, $update['name'] . '/images/l');
                         ftp_mkdir($conn, $update['name'] . '/images/l/category');
                         ftp_mkdir($conn, $update['name'] . '/images/l/articles');
                         ftp_mkdir($conn, $update['name'] . '/images/l/common');
                         ftp_mkdir($conn, $update['name'] . '/images/l/page_index');
                         ftp_mkdir($conn, $update['name'] . '/images/s');
                         ftp_mkdir($conn, $update['name'] . '/images/s/category');
                         ftp_mkdir($conn, $update['name'] . '/images/s/articles');
                         ftp_mkdir($conn, $update['name'] . '/images/s/common');
                         ftp_mkdir($conn, $update['name'] . '/images/s/page_index');
                         ftp_mkdir($conn, $update['name'] . '/mobile');
                         ftp_mkdir($conn, $update['name'] . '/mobile/images');
                         ftp_mkdir($conn, $update['name'] . '/mobile/detail');
                         ftp_mkdir($conn, $update['name'] . '/mobile/category');
                         ftp_mkdir($conn, $update['name'] . '/mobile/images/ueditor');
                         ftp_mkdir($conn, $update['name'] . '/mobile/images/l');
                         ftp_mkdir($conn, $update['name'] . '/mobile/images/l/category');
                         ftp_mkdir($conn, $update['name'] . '/mobile/images/l/articles');
                         ftp_mkdir($conn, $update['name'] . '/mobile/images/l/common');
                         ftp_mkdir($conn, $update['name'] . '/mobile/images/l/page_index');
                         ftp_mkdir($conn, $update['name'] . '/mobile/images/s');
                         ftp_mkdir($conn, $update['name'] . '/mobile/images/s/category');
                         ftp_mkdir($conn, $update['name'] . '/mobile/images/s/articles');
                         ftp_mkdir($conn, $update['name'] . '/mobile/images/s/common');
                         ftp_mkdir($conn, $update['name'] . '/mobile/images/s/page_index');
                         ftp_close($conn);
                     } else {
                         ftp_login($conn, $update['ftp_user'], $update['ftp_pwd']);
                         ftp_mkdir($conn, $update['ftp_dir'] . '/images');
                         ftp_mkdir($conn, $update['ftp_dir'] . '/detail');
                         ftp_mkdir($conn, $update['ftp_dir'] . '/category');
                         ftp_mkdir($conn, $update['ftp_dir'] . '/images/ueditor');
                         ftp_mkdir($conn, $update['ftp_dir'] . '/images/l');
                         ftp_mkdir($conn, $update['ftp_dir'] . '/images/l/category');
                         ftp_mkdir($conn, $update['ftp_dir'] . '/images/l/articles');
                         ftp_mkdir($conn, $update['ftp_dir'] . '/images/l/common');
                         ftp_mkdir($conn, $update['ftp_dir'] . '/images/l/page_index');
                         ftp_mkdir($conn, $update['ftp_dir'] . '/images/s');
                         ftp_mkdir($conn, $update['ftp_dir'] . '/images/s/category');
                         ftp_mkdir($conn, $update['ftp_dir'] . '/images/s/articles');
                         ftp_mkdir($conn, $update['ftp_dir'] . '/images/s/common');
                         ftp_mkdir($conn, $update['ftp_dir'] . '/images/s/page_index');
                         ftp_mkdir($conn, $update['ftp_dir'] . '/mobile');
                         ftp_mkdir($conn, $update['ftp_dir'] . '/mobile/images');
                         ftp_mkdir($conn, $update['ftp_dir'] . '/mobile/detail');
                         ftp_mkdir($conn, $update['ftp_dir'] . '/mobile/category');
                         ftp_mkdir($conn, $update['ftp_dir'] . '/mobile/images/ueditor');
                         ftp_mkdir($conn, $update['ftp_dir'] . '/mobile/images/l');
                         ftp_mkdir($conn, $update['ftp_dir'] . '/mobile/images/l/category');
                         ftp_mkdir($conn, $update['ftp_dir'] . '/mobile/images/l/articles');
                         ftp_mkdir($conn, $update['ftp_dir'] . '/mobile/images/l/common');
                         ftp_mkdir($conn, $update['ftp_dir'] . '/mobile/images/l/page_index');
                         ftp_mkdir($conn, $update['ftp_dir'] . '/mobile/images/s');
                         ftp_mkdir($conn, $update['ftp_dir'] . '/mobile/images/s/category');
                         ftp_mkdir($conn, $update['ftp_dir'] . '/mobile/images/s/articles');
                         ftp_mkdir($conn, $update['ftp_dir'] . '/mobile/images/s/common');
                         ftp_mkdir($conn, $update['ftp_dir'] . '/mobile/images/s/page_index');
                         ftp_close($conn);
                     }
                     $common = new CommonController();
                     @$common->postsend(trim($update['weburl'], '/') . "/urlbind.php", array('cus_name' => $update['name'], 'stage' => $update['stage'], 'pc_domain' => $update['pc_domain'], 'mobile_domain' => $update['mobile_domain']));
                     $result = ['err' => 1000, 'msg' => '创建用户成功'];
                 } else {
                     $result = ['err' => 1001, 'msg' => '创建用户失败,创建文件失败'];
                 }
             } else {
                 $result = ['err' => 1001, 'msg' => '创建用户失败'];
             }
         }
     } else {
         $result = ['err' => 1003, 'msg' => '验证信息不正确'];
     }
     return Response::json($result);
 }