作者 郭鑫

功能、接口上传

正在显示 34 个修改的文件 包含 4251 行增加317 行删除

要显示太多修改。

为保证性能只显示 34 of 34+ 个文件。

... ... @@ -15,9 +15,40 @@ use think\Db;
use think\Request;
use think\Loader;
use SmsDemo;
use api\portal\model\CodeModel;
class CommonController extends HomeBaseController
{
// connect 1 登录注册 ,2其他
public function _initialize()
{
if($this->request->param('connect')){
$connect = $this->request->param('connect');
}else{
$connect = 2;
}
if($connect == 2){
$where_firstMember['token'] = $this->request->param('token');
$firstMember = Db::name('Member')->where($where_firstMember)->field('id,update_time')->find();
if($firstMember){
if(($firstMember['update_time']+604800) < time() ){
$firstStr = rand(1000,9999).time().rand(100,999);
$firstData['token'] = $this->md5($firstStr);
$firstData['update_time'] = time();
$firstData['status'] = 1;
$firstLogin = Db::name('Member')->where($where_firstMember)->update($firstData);
if($firstLogin){
$this->apiResponse('0','请重新登录');
}else{
$this->apiResponse('0','token重置失败');
}
}
}else{
$this->apiResponse('0','暂未注册');
}
}
}
/**
* API返回信息格式函数 ;0失败,1成功,-1需要登录
* @param string $code
... ... @@ -50,6 +81,28 @@ class CommonController extends HomeBaseController
$response = SmsDemo::sendSms($tel,$code,$modelVal);
return $response;
}
// 发送验证码
// $tel 手机号
// $code 短信模板
// $type 类型
public function SmsResult($tel,$code,$type){
// $tel = $request->param('tel');
// $code = 'SMS_137416617';
$modelVal = rand(1000,9999);
$sendResult = $this->sendLogin($tel,$code,$modelVal);
$add_code['tel'] = $tel;
$add_code['code'] = $modelVal;
$add_code['type'] = $type;
$model_code = new CodeModel();
$save_code = $model_code->save($add_code);
if(!$save_code){
$this->apiResponse('0','验证码获取失败');
}
if(($sendResult->Code) != 'OK'){
$this->apiResponse('0','注册失败');
}
}
// 用户登录
public function isLogin(){
... ... @@ -64,4 +117,10 @@ class CommonController extends HomeBaseController
}
}
// 生成订单随机数
public function getmath(){
$return = rand(1000,9999).time().rand(1000,9999);
return $return;
}
}
... ...
... ... @@ -51,7 +51,7 @@ class IndexController extends CommonController
->find();
$final['process']['content'] = htmlspecialchars_decode($final['process']['content']);
// 3. 最新成交
// Db::name('Agency')->where()
... ...
... ... @@ -10,12 +10,13 @@ namespace api\portal\controller;
use api\portal\model\PortalPostModel;
use cmf\controller\RestBaseController;
use api\portal\model\MemberModel;
use think\Db;
use think\Request;
use think\Loader;
/**
* @title 用户接口
* @title 中介接口
* @description 接口说明
* @group 接口分组
*/
... ... @@ -43,45 +44,65 @@ class IntermediaryController extends CommonController
* @param name:name type:int require:1 default: other: desc:姓名
* @param name:tel type:int require:1 default: other: desc:手机号
* @param name:password type:int require:1 default: other: desc:密码
* @param name:code type:int require:1 default: other: desc:验证码
* @param name:city type:int require:1 default: other: desc:城市
* @param name:company type:int require:1 default: other: desc:所属公司
* @param name:store type:int require:1 default: other: desc:门店
* @param name:quarters type:int require:1 default: other: desc:服务小区
*/
public function join(Request $request)
{
if($request->Post()){
// 验证
$validate = Loader::validate('Intermediary');
if(!$validate->scene('add')->check($_POST)){
$validate = Loader::validate('User');
if(!$validate->scene('intermediary')->check($_POST)){
return json(array('code'=>0,'msg'=>$validate->getError()));
}
// 密码
$_POST['password'] = $this->md5($_POST['password']);
$data['password'] = $this->md5($_POST['password']);
$sure_password = $this->md5($_POST['sure_password']);
// 确认密码
if($_POST['password'] != $_POST['sure_password']){
if($data['password'] != $sure_password){
$this->apiResponse('0','两次密码不一致');
}
// 短信验证码(未完)
// 验证码
$data['tel'] = $_POST['tel'];
$code = $request->param('code');
$where_code['tel'] = $data['tel'];
$where_code['type'] = 1;
$where_code['create_time'] = array('lt',(time()+300));
$find_code = Db::name('Code')->where($where_code)->order('create_time desc')->field('code')->find();
if(!$find_code){
$this->apiResponse('0','验证码错误,请重新获取');
}
if($code != $find_code['code']){
$this->apiResponse('0','验证码错误,请重新获取');
}else{
Db::name('Code')->where($where_code)->delete();
}
$data['name'] = $_POST['name'];
// 判断手机号是否已注册
$user = new MemberModel($_POST);
$where_user['tel'] = $_POST['tel'];
$user = new MemberModel();
$where_user['tel'] = $data['tel'];
$is_isset = $user->where($where_user)->find();
if($is_isset){
$this->apiResponse('0','您已注册过,请直接登录');
}
echo "<pre/>";
print_r('1111');
die;
$str = rand('1000,9999').time().rand('100,999');
$_POST['token'] = $this->md5($str);
$add = $user->allowField(true)->save();
$str = rand(1000,9999).time().rand(100,999);
$data['token'] = $this->md5($str);
$data['type'] = 2;
$data['city'] = $request->param('city');
$data['company'] = $request->param('company');
$data['store'] = $request->param('store');
$data['quarters'] = $request->param('quarters');
$add = $user->allowField(true)->save($data);
if($add){
echo "<pre/>";
print_r('1');
die;
$this->apiResponse('1','注册成功');
}else{
echo "<pre/>";
print_r('2');
die;
$this->apiResponse('0','注册失败');
}
}else{
... ... @@ -90,7 +111,7 @@ class IntermediaryController extends CommonController
// $list = $service->publishedArticle(1,1)->toArray();
$where_pro['status'] = 1;
$where_pro['type'] = 2;
$list = Db::name('Protocol')->where($where_pro)->order("update_time desc")->find();
$list = Db::name('Protocol')->where($where_pro)->order("update_time desc")->field("title,content")->find();
// 推荐人(未完)
... ... @@ -103,45 +124,313 @@ class IntermediaryController extends CommonController
}
}
// 中介个人中心左侧信息
public function left($token){
$where_member['token'] = $token;
$where_member['status'] = 1;
$member = Db::name('Member')->where($where_member)->field('name,id,start,reputation,company,store,quarters,tel,city')->find();
if(!$member){
$this->apiResponse('0','用户信息错误');
}
// 查询签到信息
$where_checkin['agency_id'] = $member['id'];
$tme_str = date('Y-m-d',time());
$where_checkin['create_time'] = strtotime($tme_str);
$is_check = Db::name('Checkin')->where($where_checkin)->find();
if($is_check){
$member['is_checkin'] = 1;
}else{
$member['is_checkin'] = 0;
}
return $member;
}
// 登录
public function login(Request $request){
if($request->post()){
// 登录验证
// 判空
$tel = $request->param('tel');
$password = $request->param('password');
$true = $request->param('true');
$token = $request->param('token');
if(empty($tel)){
$this->apiResponse('0','手机号不能为空');
}else if(empty($password)){
$this->apiResponse('0','密码不能为空');
}else if(empty($true)){
$this->apiResponse('0','验证码不能为空');
/**
* @title 中介个人中心首页(over)
* @description 接口说明
* @author 开发者
* @url /api/portal/Intermediary/myIndex
* @method POST
* @param name:token type:int require:1 default: other: desc:token
* @param name:page type:int require:1 default: other: desc:页码
*/
public function myIndex(Request $request){
$token = $request->param('token');
$member = $this->left($token);
$final['intermediary'] = $member;
$where_need['city'] = $member['city'];
$where_need['status'] = 2;
$where_need['quarters'] = array('like','%'.$member['quarters'].'%');
$page = $request->param('page');
$need_list = Db::name('UserNeed')->where($where_need)->field("id,city,quarters,room,floor,house_type,renovation,quotation_time,create_time,people")->limit(10)->page($page)->select()->toArray();
if($need_list){
$final['intermediary_need'] = $need_list;
}else{
$final['intermediary_need'] = array();
}
$this->apiResponse('1','成功',$final);
}
/**
* @title 中介个人中心匹配需求详情(over)
* @description 接口说明
* @author 开发者
* @url /api/portal/Intermediary/mySend
* @method POST
* @param name:token type:int require:1 default: other: desc:token
* @param name:need_id type:int require:1 default: other: desc:需求id
*/
public function mySend(Request $request){
$token = $request->param('token');
$member = $this->left($token);
$final['intermediary'] = $member;
if(!$request->param('need_id')){
$this->apiResponse('0','请选择需求id');
}
$where_need['id'] = $request->param('need_id');
$where_need['status'] = 2;
$need_list = Db::name('UserNeed')->where($where_need)
->field("id,user_id,city,quarters,room,floor,house_type,renovation,area,is_first,loan,contract,quotation_time,create_time,people")
->find();
if($need_list){
$final['intermediary_need'] = $need_list;
}else{
$final['intermediary_need'] = array();
}
$this->apiResponse('1','成功',$final);
}
// 查询中介报价
// $need_id 需求id
public function agencyOffer($user_id,$need_id){
$where_agency['status'] = 2;
$where_agency['create_time'] = array('lt',time());
$where_agency['need_id'] = $need_id;
$agency_list = Db::name('Agency')
->where($where_agency)
->field("id,housing_price,assessment_tax,security_tax,else_tax,service_charge")
->select()->toArray();
$final_list = array();
$add_arr = array();
if($agency_list){
foreach ($agency_list as $agencyk=>$agencyv){
$final_list[$agencyk]['need_id'] = $need_id;
$final_list[$agencyk]['agency_id'] = $agencyv['id'];
$final_list[$agencyk]['user_id'] = $user_id;
$money = $agencyv['housing_price']*10000 + $agencyv['assessment_tax'] + $agencyv['security_tax'] + $agencyv['else_tax'] + $agencyv['service_charge'] ;
$money_arr[] = $money;
$fianlMoney = substr($money, 0,-4);
$final_list[$agencyk]['true_money'] = $money;
$final_list[$agencyk]['money'] = $fianlMoney;
}
// 验证
$where_member['tel'] = $tel;
$where_member['password'] = $password;
// $where_member['token'] = $token;
$member = Db::name('Member')->where($where_member)->find();
if($member){
if($member['token'] != $token){
$this->apiResponse('0','登录失败');
sort($money_arr);
foreach ($final_list as $finalk=>$finalv){
if($finalv['true_money'] == $money_arr[0]){
$add_arr['need_id'] = $finalv['need_id'];
$add_arr['agency_id'] = $finalv['agency_id'];
$add_arr['user_id'] = $finalv['user_id'];
$add_arr['money'] = $finalv['money'];
$add_arr['create_time'] = time();
$add_arr['update_time'] = time();
}
if($member['update_time'] >= (time()+604800)){
$this->apiResponse('0','请重新登录');
}else{
$this->apiResponse('1','登录成功');
}
}else{
$this->apiResponse('0','您输入的账号或密码不正确');
}
$save = Db::name('See')->insertGetId($add_arr);
$return['id'] = $save;
$return['money'] = $add_arr['money'];
$return['time'] = time();
return $return;
}
}
// 透视卡
//token
//need_id
public function see(Request $request){
$data = $request->param();
$user = $this->left($data['token']);
$user_id = $user['id'];
// 购买支付
// 成功加入记录
// 加订单
$add = array();
$add['name'] = '购买透视卡';
$add['order_sn'] = $this->getmath();
$add['type'] = 3;
$add['need_id'] = $data['need_id'];
$add['is_get'] = 2;
// 查询透视卡金额
$add['money'] = 2;
$add['status'] = 1;
$add['create_time'] = time();
$add['update_time'] = time();
$order_id = Db::name('Order')->insertGetId($add);
if(!$order_id){
$this->apiResponse('0','购买失败');
}
// 支付成功
// 修改订单状态
$where_order['order_sn'] = $data['order_sn'];
$save['update_time'] = time();
$save['pay_time'] = time();
$is_save = Db::name('Order')->where($where_order)->update($save);
if($is_save){
return true;
}else{
return false;
}
// 查询报价
$money = $this->agencyOffer($user_id,$data['need_id']);
}
/**
* @title 中介个人中心我的报价
* @description 接口说明
* @author 开发者
* @url /api/portal/Intermediary/myMoney
* @method POST
* @param name:token type:int require:1 default: other: desc:token
* @param name:page type:int require:1 default: other: desc:页码
*/
public function myMoney(Request $request){
$data = $request->param();
$my = $this->left($data['token']);
$final['intermediary'] = $my;
$where_need['agency_id'] = $my['id'];
$page = $data['page'];
$need = Db::name('Agency')->where($where_need)->limit(10)->page($page)->select()->toArray();
if($need){
$final['need'] = $need;
}else{
$final['need'] = array();
}
$this->apiResponse('1','成功',$final);
}
/**
* @title 中介个人中心我的报价详情
* @description 接口说明
* @author 开发者
* @url /api/portal/Intermediary/myDetail
* @method POST
* @param name:token type:int require:1 default: other: desc:token
* @param name:intermediaryNeed_id type:int require:1 default: other: desc:报价id
*/
public function myDetail(Request $request){
$data = $request->param();
$my = $this->left($data['token']);
$final['intermediary'] = $my;
$where_need['agency_id'] = $my['id'];
$where_need['i.id'] = $data['intermediaryNeed_id'];
$need = Db::name('Agency')->alias('i')
->where($where_need)
->join("hp_user_need u",'u.id = i.need_id')
->find();
if($need){
$final['need'] = $need;
}else{
// 返回验证码图片
$final['need'] = array();
}
$this->apiResponse('1','成功',$final);
}
/**
* @title 中介个人中心我的资料
* @description 接口说明
* @author 开发者
* @url /api/portal/Intermediary/myDetail
* @method POST
* @param name:token type:int require:1 default: other: desc:token
* @param name:intermediaryNeed_id type:int require:1 default: other: desc:报价id
*/
public function mySelf(Request $request){
$data = $request->param();
$my = $this->left($data['token']);
$final['intermediary'] = $my;
$where_card['user_id'] = $my['id'];
$where_card['status'] = 1;
$card = Db::name('Card')->where($where_card)->select()->toArray();
$final['card'] = $card;
$this->apiResponse('1','成功',$final);
}
/**
* @title 中介资料修改
* @description 接口说明
* @author 开发者
* @url /api/portal/Intermediary/myIndex
* @method POST
* @param name:token type:int require:1 default: other: desc:token
* @param name:company type:int require:1 default: other: desc:所属公司
* @param name:store type:int require:1 default: other: desc:门店
* @param name:quarters type:int require:1 default: other: desc:服务小区
* @return data:''@
* @data status:'状态(1->待发布,2->已发布,待报价,3->已成交,4->未交保证金,5->已过期,6->未选择中介,7->中介未确认,8->报价人数不足,9->删除)'
*/
public function myChange(Request $request){
$update_member = $request->param();
$update_member['status'] = 1;
$update_member['type'] = 2;
$model = new MemberModel();
$member = $model->update($update_member);
if(!$member){
$this->apiResponse('0','更新失败');
}else{
$this->apiResponse('1','更新成功');
}
}
/**
* @title 中介签到
* @description 接口说明
* @author 开发者
* @url /api/portal/Intermediary/checkIn
* @method POST
* @param name:token type:int require:1 default: other: desc:token
* @return data:''@
*/
public function checkIn(Request $request){
$data = $request->param();
$mes = $this->left($data['token']);
if($mes['is_checkin'] == 0){
$add['agency_id'] = $mes['id'];
$time = date('Y-m-d',time());
$add['create_time'] = strtotime($time);
$add['update_time'] = time();
$result = Db::name('Checkin')->insertGetId($add);
if($request){
$where_addStart['id'] = $mes['id'];
$addStart = Db::name('Member')->where($where_addStart)->setInc('start',1);
if($addStart){
$this->apiResponse('1','签到成功');
}else{
$this->apiResponse('0','签到失败');
}
}else{
$this->apiResponse('0','签到失败');
}
}else{
$this->apiResponse('0','您已签到');
}
}
}
... ...
<?php
// +----------------------------------------------------------------------
// | ThinkCMF [ WE CAN DO IT MORE SIMPLE ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013-2017 http://www.thinkcmf.com All rights reserved.
// +----------------------------------------------------------------------
// | Author: wuwu <15093565100@163.com>
// +----------------------------------------------------------------------
namespace api\portal\controller;
use api\portal\model\MemberModel;
use api\portal\model\PortalPostModel;
use cmf\controller\RestBaseController;
use think\Db;
use think\Request;
use think\Loader;
use think\Config;
use think\captcha\Captcha;
use think\Url;
use SmsDemo;
//use think\Route;
/**
* @title 用户接口
* @description 接口说明
* @group 接口分组
*/
class IntermediaryNeedController extends CommonController
{
protected $postModel;
public function __construct(PortalPostModel $postModel)
{
parent::__construct();
$this->postModel = $postModel;
}
/**
* @title 用户发布需求的保证金
* @description 接口说明
* @author 开发者
* @url /api/portal/UserNeed/payMoney
* @method POST
* @param name:city type:int require:1 default: other: desc:地区
* @param name:quarters type:int require:1 default: other: desc:小区
* @param name:password type:int require:1 default: other: desc:密码
*/
public function payMoney(Request $request){
$data = $request->param();
if(!$data['city'] || !$data['area'] ){
$this->apiResponse('0','城市、面积不能为空');
}
$city = $data['city'];
$area = $data['area'];
$where_money[''] =
Db::name('MoneyRule')->where()
}
/**
* @title 用户发布需求
* @description 接口说明
* @author 开发者
* @url /api/portal/UserNeed/send
* @method POST
* @param name:city type:int require:1 default: other: desc:地区
* @param name:quarters type:int require:1 default: other: desc:小区
* @param name:password type:int require:1 default: other: desc:密码
*/
public function send(Request $request)
{
if($request->Post()){
$data = $request->param();
// 判空,处理
// 加数据库
}else{
// 问答内容
$where_pro['status'] = 1;
$list = Db::name('NeedAnswer')->where($where_pro)->order("update_time desc")->find();
if($list){
$this->apiResponse('1','成功',$list);
}else{
$this->apiResponse('0','暂无内容');
}
}
}
}
<?php
// +----------------------------------------------------------------------
// | ThinkCMF [ WE CAN DO IT MORE SIMPLE ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013-2017 http://www.thinkcmf.com All rights reserved.
// +----------------------------------------------------------------------
// | Author: wuwu <15093565100@163.com>
// +----------------------------------------------------------------------
namespace api\portal\controller;
use api\portal\model\AgencyModel;
use api\portal\model\OrderModel;
use api\portal\model\UserNeedModel;
use api\portal\model\MemberModel;
use api\portal\model\PortalPostModel;
use cmf\controller\RestBaseController;
use think\Db;
use think\Request;
use think\Loader;
use think\Config;
use think\captcha\Captcha;
use think\Url;
use SmsDemo;
//use think\Route;
/**
* @title 中介需求接口
* @description 接口说明
* @group 接口分组
*/
class IntermediaryneedController extends CommonController
{
protected $postModel;
public function __construct(PortalPostModel $postModel)
{
parent::__construct();
$this->postModel = $postModel;
}
/**
* @title 中介报价时保证金金额(填完房价调用;每次修改重新调用)
* @description 接口说明
* @author 开发者
* @url /api/portal/Intermediaryneed/payMoney
* @method POST
* @param name:housing_price type:int require:1 default: other: desc:房价
* @param name:token type:int require:1 default: other: desc:token
*/
public function payMoney(Request $request){
$data = $request->param();
$where_inteRule['status'] = 1;
$where_inteRule['low'] = array('gt',$data['housing_price']);
$where_inteRule['height'] = array('lt',$data['housing_price']);
$inte_money = Db::name('IntermediaryRule')->where($where_inteRule)->field('money')->find();
if(!$inte_money){
$this->apiResponse('0','保证金获取失败');
}else{
$this->apiResponse('1','成功',$inte_money['money']);
}
}
/**
* @title 匹配需求
* @description 接口说明
* @author 开发者
* @url /api/portal/Intermediaryneed/sendNeed
* @method POST
* @param name:token type:int require:1 default: other: desc:token
* @return data:''@
* @data city:'地区'
* @data quarters:'小区'
* @data room:'具体房号'
* @data floor:'楼层'
* @data house_type:'户型'
* @data renovation:'装修'
* @data quotation_time:'报价时间(天)'
* @data create_time:'发布时间'
* @data people:'报价人数'
*/
public function sendNeed(Request $request){
$data = $request->param();
$where_member['token'] = $data['token'];
// 查询,匹配:省市区县精确匹配,小区名模糊匹配(只要有连续字匹配,就算匹配)
$member_find = Db::name('Member')->where($where_member)->field("city,quarters")->find();
if(!$member_find){
$this->apiResponse('0','用户信息错误');
}
$where_need['city'] = $member_find['city'];
$where_need['status'] = 2;
$where_need['quarters'] = array('like','%'.$member_find['quarters'].'%');
$need_list = Db::name('UserNeed')->where($where_need)->field("id,city,quarters,room,floor,house_type,renovation,quotation_time,create_time")->select()->toArray();
if($need_list){
$this->apiResponse('1','成功',$need_list);
}else{
$this->apiResponse('0','该地区暂无匹配需求');
}
}
/**
* @title 中介报价
* @description 接口说明
* @author 开发者
* @url /api/portal/Intermediaryneed/send
* @method POST
* @param name:need_id type:varchar require:1 default: other: desc:需求id
* @param name:housing_price type:varchar require:1 default: other: desc:房价
* @param name:assessment_tax type:varchar require:1 default: other: desc:评估税
* @param name:value_added_tax type:int require:1 default: other: desc:增值税
* @param name:security_tax type:varchar require:1 default: other: desc:贷款担保税
* @param name:deed_tax type:varchar require:1 default: other: desc:契税
* @param name:else_tax type:varchar require:1 default: other: desc:其他税费
* @param name:personal_income_tax type:tinyint require:1 default: other: desc:个税
* @param name:service_charge type:tinyint require:1 default: other: desc:居间服务费
* @param name:else type:int require:1 default: other: desc:备注
* @param name:token type:varchar require:1 default: other: desc:token
* @return data:''@
* @data is_loan:'全款'
* @data is_contract:'非包干价'
*/
public function send(Request $request)
{
if($request->Post('token') && $request->Post('housing_price')){
// 判空,处理
$validate = Loader::validate('IntermediaryNeed');
if(!$validate->scene('offer')->check($_POST)){
return json(array('code'=>0,'msg'=>$validate->getError()));
}
// 加数据库
$data = $request->Post();
$model = new AgencyModel();
$where_mem['token'] = $data['token'];
$mem_id = Db::name('Member')->where($where_mem)->field('id')->find();
$data['agency_id'] = $mem_id['id'];
// 判断是否已发布过
$where_isIsset['need_id'] = $data['need_id'];
$where_isIsset['agency_id'] = $mem_id['id'];
$find_isset = $model->where($where_isIsset)->find();
if($find_isset){
$this->apiResponse('0','该房屋您已参与报价');
}
$data['all_price'] = $data['housing_price']*10000 + $data['assessment_tax'] + $data['value_added_tax'] + $data['security_tax'] + $data['deed_tax'] + $data['else_tax'] + $data['personal_income_tax'] + $data['service_charge'];
// 查询中介保证金
$where_inteRule['status'] = 1;
$where_inteRule['low'] = array('lt',$data['housing_price']);
$where_inteRule['height'] = array('egt',$data['housing_price']);
$inte_money = Db::name('IntermediaryRule')->where($where_inteRule)->field('money')->find();
if(!$inte_money){
$this->apiResponse('0','保证金获取失败');
}else{
$data['deposit'] = $inte_money['money'];
}
unset($data['token']);
$save = $model->save($data);
$final['intermediaryNeed_id'] = $model->getLastInsID();
if($save){
$this->apiResponse('1','添加成功',$final);
}else{
$this->apiResponse('0','添加失败');
}
}else{
// 问答内容
$where_pro['status'] = 1;
$where_pro['type'] = 2;
$list = Db::name('NeedAnswer')->where($where_pro)->order("update_time desc")->field("title,content,id,type")->select()->toArray();
foreach ($list as $lk=>$lv){
$list[$lk]['content'] = htmlspecialchars_decode($lv['content']);
}
if($list){
$final['content'] = $list;
// 查询用户发布需求
if(!$request->param('need_id')){
$this->apiResponse('0','请选择报价房屋');
}
$where_need['id'] = $request->param('need_id');
$where_need['status'] = 2;
$need = Db::name('UserNeed')->where($where_need)->field("loan,contract")->find();
if(!$need){
$this->apiResponse('0','该需求暂不可报价');
}
// 全款
if($need['loan'] == 2 ){
$final['is_loan'] = 1;
}
// 包干价
if($need['contract'] == 2 ){
$final['is_contract'] = 1;
}
$this->apiResponse('1','成功',$final);
}else{
$this->apiResponse('0','暂无内容');
}
}
}
// 报价支付(付款成功,报价人数+1)
public function needPay(Request $request){
// 添加订单
Db::startTrans();
$data = $request->param();
if(!$data['need_id']){
$this->apiResponse('0','需求不能为空');
}
// 查询金额
$where_need['id'] = $data['need_id'];
$where_need['status'] = 1;
$should_pay = Db::name('UserNeed')->where($where_need)->field('pay_money')->find();
if(!$should_pay){
$this->apiResponse('0','需求错误');
}else{
if(!$should_pay['pay_money']){
$this->apiResponse('0','诚意金金额有误');
}
}
// 拼字度
$add['need_id'] = $data['need_id'];
$add['money'] = $should_pay['pay_money'];
$add['name'] = '诚意金缴纳';
$add['type'] = 1;
$add['is_get'] = 2;
$add['status'] = 1;
// 加入数据库
$model = new OrderModel();
$save = $model->save($add);
if($save){
Db::commit();
}else{
Db::rollback();
}
// 支付(未完)
echo "<pre/>";
print_r('3333');
die;
// 更改订单状态
// 成功
$update['pay_time'] = time();
$update['status'] = time();
$update = $model->isUpdate(true)->allowField(true)->save($update);
if($update){
$this->apiResponse('1','支付成功');
}
}
}
... ...
<?php
// +----------------------------------------------------------------------
// | ThinkCMF [ WE CAN DO IT MORE SIMPLE ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013-2017 http://www.thinkcmf.com All rights reserved.
// +----------------------------------------------------------------------
// | Author: wuwu <15093565100@163.com>
// +----------------------------------------------------------------------
namespace api\portal\controller;
use cmf\controller\HomeBaseController;
use api\portal\model\PortalPostModel;
use cmf\controller\RestBaseController;
use think\Db;
use think\Request;
use think\Loader;
use think\Config;
use think\captcha\Captcha;
use think\Url;
use SmsDemo;
//use think\Route;
/**
* @title 30分钟后发布
* @description 接口说明
* @group 接口分组
*/
class ThirdsendController extends HomeBaseController
{
protected $postModel;
public function __construct(PortalPostModel $postModel)
{
parent::__construct();
$this->postModel = $postModel;
}
// 查询中介报价
// $need_id 需求id
public function Offer($user_id,$need_id){
$where_agency['status'] = 2;
$where_agency['create_time'] = array('lt',time());
$where_agency['need_id'] = $need_id;
$agency_list = Db::name('Agency')
->where($where_agency)
// ->field("id,housing_price,assessment_tax,security_tax,else_tax,service_charge")
->select()->toArray();
if($agency_list){
foreach ($agency_list as $agencyk=>$agencyv){
// $final_list[$agencyk] = $agencyv;
// $final_list[$agencyk]['agency_id'] = $agencyv['id'];
// $final_list[$agencyk]['user_id'] = $user_id;
$money = $agencyv['housing_price']*10000 + $agencyv['assessment_tax'] + $agencyv['security_tax'] + $agencyv['else_tax'] + $agencyv['service_charge'] ;
$money_arr[] = $money;
$fianlMoney = substr($money, 0,-4);
$agency_list[$agencyk]['true_money'] = $money;
// $final_list[$agencyk]['money'] = $fianlMoney;
}
sort($money_arr);
if(count($money_arr) > 3 ){
foreach ($agency_list as $finalk=>$finalv){
foreach ($money_arr as $monryk=>$moneyv){
if($finalv['true_money'] == $moneyv){
$return[] = $finalv;
}
}
}
}else{
$save['status'] = 8;
}
return $return;
}
}
// 30分钟后发布
public function thirdSend(){
Db::startTrans();
$where_need['status'] = 1;
$userNeedList = Db::name('UserNeed')->where($where_need)->field('id,create_time')->select()->toArray();
$time = time();
$change_arr = array();
foreach ($userNeedList as $userk=>$userv){
if($userv['create_time'] <= ($time+60) && $userv['create_time'] >= $time){
$change_arr[] = $userv['id'];
}
}
if($change_arr){
$where_save['id'] = array('in',$change_arr);
$save['status'] = 2;
$save['update_time'] = time();
$fianl_save = Db::name('UserNeed')->where($where_save)->update($save);
if($fianl_save){
Db::commit();
}else{
Db::rollback();
}
}
}
// 规定时间结束报价
public function over()
{
Db::startTrans();
// 查询用户发布需求信息
$where_need['status'] = 2;
$userNeedList = Db::name('UserNeed')->where($where_need)->field('id,quotation_time,create_time')->select()->toArray();
$change_arr = array();
$time = time();
$time = '1529734985';
// 循环需求,查询相应报价
foreach ($userNeedList as $uNeedk => $uNeedv) {
$final_time = $uNeedv['create_time'] + $uNeedv['quotation_time'] * 86400;
if ($final_time <= ($time + 60) && $final_time >= $time) {
$us_middleid = $uNeedv['id'];
$where_agency['a.status'] = 2;
$where_agency['a.create_time'] = array('lt', time());
$where_agency['a.need_id'] = $uNeedv['id'];
$where_agency['m.type'] = 2;
$where_agency['m.status'] = 1;
$agency_list = Db::name('Agency')->alias('a')
->where($where_agency)
->join("hp_Member m", 'm.id = a.agency_id')
->field('a.*,m.company')
->select()->toArray();
// 查询品牌企业
$where_brand['status'] = 1;
$band_list = Db::name('Brand')->where($where_brand)->column('name');
$agen_arr = array();
$money_arr = array();
if ($agency_list) {
// 判断是否超过三个报价人
if (count($agency_list) >= 3) {
// 查询三人中是否有品牌中介
// 循环匹配品牌企业
foreach ($agency_list as $agencyk => $agencyv) {
foreach ($band_list as $brak => $brav) {
// 判断是否在品牌企业中
if (strstr($brav, $agencyv['company']) !== false) {
// 存在
$agen_money = $agencyv['housing_price'] * 10000 + $agencyv['assessment_tax'] + $agencyv['security_tax'] + $agencyv['else_tax'] + $agencyv['service_charge'];
if (empty($agen_arr)) {
$agen_arr[0]['money'] = $agen_money;
$agen_arr[0]['id'] = $agencyv['id'];
} else {
// 判断大小
if ($agen_money < $agen_arr[0]['money']) {
$agen_arr[0]['money'] = $agen_money;
$agen_arr[0]['id'] = $agencyv['id'];
}
}
}
}
// 取出前三报价
$money = $agencyv['housing_price'] * 10000 + $agencyv['assessment_tax'] + $agencyv['security_tax'] + $agencyv['else_tax'] + $agencyv['service_charge'];
$money_list[$agencyv['id']] = $money;
}
asort($money_list);
$k = 0;
foreach ($money_list as $mok => $mov) {
if ($k < 3) {
$fin_list[$k]['id'] = $mok;
$fin_list[$k]['money'] = $mov;
$fin_arr[] = $mok;
}
$k += 1;
}
$ag_id = implode(',', $fin_arr);
$userSave_status['status'] = 5;
$agencySave_status['status'] = 4;
} else {
// 报价小于3人,更改订单状态,报价失败
$userSave_status['status'] = 4;
$agencySave_status['status'] = 7;
}
} else {
// 没有报价
$userSave_status['status'] = 4;
$agencySave_status['status'] = 7;
}
$us_id = implode(',', $us_middleid);
// 插入数据库
// 用户需求表
$where_us['id'] = array('in', $us_id);
$fianl_Ussave = Db::name('UserNeed')->where($where_us)->update($userSave_status);
if(!$fianl_Ussave){
Db::rollback();
}
// 中介报价表
$where_ag['id'] = array('in', $ag_id);
$fianl_Agsave = Db::name('Agency')->where($where_ag)->update($agencySave_status);
if(!$fianl_Agsave){
Db::rollback();
}else{
Db::commit();
}
}
}
}
// 三天用户选择
public function userChoose(){
Db::startTrans();
// 查询用户发布需求信息
$where_need['status'] = 2;
$userNeedList = Db::name('UserNeed')->where($where_need)->field('id,quotation_time,create_time')->select()->toArray();
}
// 三天中介确认
public function intermediaryChoose(){
}
}
... ...
... ... @@ -8,6 +8,7 @@
// +----------------------------------------------------------------------
namespace api\portal\controller;
use api\portal\model\MemberModel;
use api\portal\model\PortalPostModel;
use cmf\controller\RestBaseController;
... ... @@ -35,30 +36,77 @@ class UserController extends CommonController
}
// 验证码图片
function getImgUrl($id = "")
public function getImgUrl($id = "")
{
\think\Route::get('captcha/[:id]', "\\think\\captcha\\CaptchaController@index");
\think\Validate::extend('captcha', function ($value, $id = "") {
return captcha_check($value, $id, (array)\think\Config::get('captcha'));
});
$middle_url = \think\Url::build('/captcha/new' . ($id ? "/{$id}" : ''));
$rand = str_replace(".","",substr(microtime(true),-5)).rand(1000,9999);
$imgUrl = $middle_url."&time=".$rand;
return $imgUrl;
}
// 获取短信验证码
/**
* @title 获取短信验证码(用户注册/中介注册)
* @description 接口说明
* @author 开发者
* @url /api/portal/User/getSmsResult
* @method POST
* @param name:tel type:int require:1 default: other: desc:手机号
* @param name:imgCode type:int require:1 default: other:genre=2时传 desc:图片验证码
* @param name:genre type:int require:1 default: other: desc:类型(1->用户注册/中介注册,2->密码找回,3->发布需求,4->修改手机号,5->绑定银行卡)
* @param name:connect type:int require:1 default: other:1 登录注册 ,2其他 desc:1
* @param name:token type:int require:1 default: other: desc:token
*/
// 获取短信验证码(登录)
public function getSmsResult(Request $request){
// 短信验证码
if(!$request->param('tel')){
$this->apiResponse('0','请输入手机号');
}else{
$tel = $request->param('tel');
$code = 'SMS_137416617';
$modelVal = rand(1000,9999);
$sendResult = $this->sendLogin($tel,$code,$modelVal);
if(($sendResult->Code) != 'OK'){
$this->apiResponse('0','注册失败');
}else{
$_SESSION('code',$modelVal);
$_SESSION('tel',$tel);
}
if(!$request->param('genre')){
$this->apiResponse('0','请选择类型');
}else{
$genre = $request->param('genre');
if($genre == 1 ){
$code = 'SMS_137416617';
$type = 1;
}else if($genre == 2 ){
// 验证图形验证码
// 验证码
session_start();
if(!$request->param('imgCode')){
$this->apiResponse('0','请先输入图形验证码');
}
$result = cmf_captcha_check($request->param('imgCode'));
if(!$result) {
$this->apiResponse('0','验证码错误');
}
$code = 'SMS_137411611';
$type = 2;
}else if($genre == 3 ){
$code = 'SMS_137426773';
$type = 3;
}else if($genre == 4 ){
$code = 'SMS_137421639';
$type = 4;
}else if($genre == 5 ){
$code = 'SMS_137416654';
$type = 5;
}
$tel = $request->param('tel');
}
$this->SmsResult($tel,$code,$type);
}
/**
... ... @@ -71,41 +119,41 @@ class UserController extends CommonController
* @param name:tel type:int require:1 default: other: desc:手机号
* @param name:password type:int require:1 default: other: desc:密码
* @param name:sure_password type:int require:1 default: other: desc:确认密码
* @param name:code type:int require:1 default: other: desc:验证码
* @param name:connect type:int require:1 default: other:1 登录注册 ,2其他 desc:1
* @return data:'token'
*/
public function join(Request $request)
{
if($request->Post()){
if($request->Post() && $request->Post('name')) {
// 验证
$validate = Loader::validate('User');
if(!$validate->scene('add')->check($_POST)){
return json(array('code'=>0,'msg'=>$validate->getError()));
if (!$validate->scene('user')->check($_POST)) {
return json(array('code' => 0, 'msg' => $validate->getError()));
}
$data['password'] = $this->md5($_POST['password']);
$sure_password = $this->md5($_POST['sure_password']);
// 确认密码
if($data['password'] != $sure_password){
$this->apiResponse('0','两次密码不一致');
}
// 密码
// 短信验证码
// $tel = $request->param('tel');
// $code = 'SMS_137416617';
// $modelVal = rand(1000,9999);
// $sendResult = $this->sendLogin($tel,$code,$modelVal);
// if(($sendResult->Code) != 'OK'){
// $this->apiResponse('0','注册失败');
// }
if ($data['password'] != $sure_password) {
$this->apiResponse('0', '两次密码不一致');
}
// 验证码
$data['tel'] = $_POST['tel'];
$code = $request->param('code');
if($data['tel'] != $_SESSION['tel']){
$where_code['tel'] = $data['tel'];
$where_code['type'] = 1;
$where_code['create_time'] = array('lt',(time()+300));
$find_code = Db::name('Code')->where($where_code)->order('create_time desc')->field('code')->find();
if(!$find_code){
$this->apiResponse('0','验证码错误,请重新获取1');
}
if($code != $find_code['code']){
$this->apiResponse('0','验证码错误,请重新获取');
}else{
if($code != $_SESSION['code']){
$this->apiResponse('0','验证码错误,请重新获取');
}
Db::name('Code')->where($where_code)->delete();
}
unset($_SESSION['code']);
$data['name'] = $_POST['name'];
// 判断手机号是否已注册
... ... @@ -117,17 +165,29 @@ class UserController extends CommonController
}
$str = rand(1000,9999).time().rand(100,999);
$data['token'] = $this->md5($str);
$data['type'] = 1;
$data['start'] = 50;
$add = $user->allowField(true)->save($data);
if($add){
$this->apiResponse('1','注册成功');
$startAdd['detail'] = '注册获得';
$startAdd['star'] = 50;
$startAdd['type'] = 1;
$startAdd['create_time'] = time();
$startAdd['update_time'] = time();
$star = Db::name('StartDetail')->insertGetId($startAdd);
if($star){
$this->apiResponse('1','注册成功',$data['token']);
}else{
}
}else{
$this->apiResponse('0','注册失败');
}
}else{
// 服务协议
// $service = new PostService();
// $list = $service->publishedArticle(1,1)->toArray();
$where_pro['status'] = 1;
$where_pro['type'] = 1;
$list = Db::name('Protocol')->where($where_pro)->order("update_time desc")->field("title,content")->find();
... ... @@ -143,15 +203,27 @@ class UserController extends CommonController
}
}
/**
* @title 用户登录
* @description 接口说明
* @author 开发者
* @url /api/portal/User/login
* @method POST
* @param name:tel type:int require:1 default: other: desc:手机号
* @param name:password type:int require:1 default: other: desc:密码
* @param name:imgCode type:int require:1 default: other: desc:验证码
* @param name:connect type:int require:1 default: other:1 登录注册 ,2其他 desc:1
* @return data:''@
* @data type:'1->用户,2->中介'
*/
// 登录
public function login(Request $request){
if($request->post()){
if($request->post() && $request->Post('tel')){
// 登录验证
// 判空
$tel = $request->param('tel');
$password = $request->param('password');
$true = $request->param('true');
$true = $request->param('imgCode');
$token = $request->param('token');
if(empty($tel)){
$this->apiResponse('0','手机号不能为空');
... ... @@ -161,46 +233,59 @@ class UserController extends CommonController
$this->apiResponse('0','验证码不能为空');
}
// 验证
// 验证码
session_start();
$result = cmf_captcha_check($true);
if(!$result) {
$this->apiResponse('0','验证码错误');
}
// 手机、密码
// $member_model = new MemberModel();
$where_member['tel'] = $tel;
$where_member['password'] = $password;
// $where_member['token'] = $token;
$member = Db::name('Member')->where($where_member)->find();
$where_member['password'] = $this->md5($password);
$token_str = rand(1000,9999).time().rand(100,999);
$update_member['token'] = $this->md5($token_str);
$update_member['update_time'] = time();
$member = Db::name('Member')->where($where_member)->update($update_member);
if($member){
if($member['token'] != $token){
$this->apiResponse('0','登录失败');
}
if($member['update_time'] >= (time()+604800)){
$this->apiResponse('0','请重新登录');
}else{
$this->apiResponse('1','登录成功');
}
$this->apiResponse('1','登录成功',$member);
}else{
$this->apiResponse('0','您输入的账号或密码不正确');
}
}else{
// 返回验证码图片
$img = $this->getImgUrl();
$this->apiResponse('1','成功',$img);
}
}
/**
* @title 用户退出登录
* @description 接口说明
* @author 开发者
* @url /api/portal/User/outLogin
* @method POST
* @param name:user_id type:int require:1 default: other: desc:user_id
* @param name:connect type:int require:1 default: other:1 登录注册 ,2其他 desc:2
* @param name:token type:int require:1 default: other: desc:token
*/
// 退出登录
public function outLogin(Request $request){
// 重置token
$str = rand('1000,9999').time().rand('100,999');
$str = rand(1000,9999).time().rand(100,999);
$change['token'] = $this->md5($str);
$where_member['id'] = $request->param('user_id');
$where_member['token'] = $request->param('token');
$model = new MemberModel();
$member = $model->where($where_member)->find();
if($member){
$change['id'] = $request->param('user_id');
$update = $model->isUpdate(true)->allowField(true)->save($change);
$where_change['id'] = $request->param('user_id');
// $update = $model->isUpdate(true)->allowField(true)->save($change);
$change['update_time'] = time();
$update = $model->where($where_change)->update($change);
if($update){
unset($_SESSION['user_id']);
// unset($_SESSION['user_id']);
$this->apiResponse('1','退出成功');
}else{
$this->apiResponse('0','退出失败');
... ... @@ -209,6 +294,490 @@ class UserController extends CommonController
$this->apiResponse('0','用户信息错误');
}
}
// 修改密码
/**
* @title 用户修改密码
* @description 接口说明
* @author 开发者
* @url /api/portal/User/changePassword
* @method POST
* @param name:password type:int require:1 default: other: desc:旧密码
* @param name:newPassword type:int require:1 default: other: desc:新密码
* @param name:sureNewPassword type:int require:1 default: other: desc:确认新密码
* @param name:connect type:int require:1 default: other:1 登录注册 ,2其他 desc:2
* @param name:token type:int require:1 default: other: desc:token
*/
// 修改密码
public function changePassword(Request $request){
$data = $request->param();
if(empty($data['password'])){
$this->apiResponse('0','请输入原密码');
}
if(empty($data['newPassword'])){
$this->apiResponse('0','请输入新密码');
}
if(empty($data['sureNewPassword'])){
$this->apiResponse('0','请输入确认新密码');
}
$where_member['password'] = $this->md5($data['password']);
$where_member['id'] = $data['user_id'];
$user_id = Db::name('Member')->where($where_member)->field('id')->find();
if($user_id){
if($data['newPassword'] == $data['sureNewPassword']){
$where_update['id'] = $user_id['id'];
$middleStr = rand(1000,9999).time().rand(100,999);
$update['token'] = $this->md5($middleStr);
$update['password'] = $this->md5($data['newPassword']);
$is_update = Db::name('Member')->where($where_update)->update($update);
if($is_update){
$this->apiResponse('1','成功',$update['token']);
}else{
$this->apiResponse('0','修改失败');
}
}else{
$this->apiResponse('0','两次密码输入不一致');
}
}else{
$this->apiResponse('0','原密码输入错误');
}
}
/**
* @title 密码找回
* @description 接口说明
* @author 开发者
* @url /api/portal/User/findPassword
* @method POST
* @param name:tel type:int require:1 default: other: desc:手机号
* @param name:imgCode type:int require:1 default: other: desc:图片验证码
* @param name:code type:int require:1 default: other: desc:短信验证码
* @param name:newPassword type:int require:1 default: other: desc:新密码
* @param name:sureNewPassword type:int require:1 default: other: desc:确认新密码
* @param name:connect type:int require:1 default: other:1 登录注册 ,2其他 desc:2
*/
public function findPassword(Request $request){
$data = $request->param();
if($data){
if(empty($data['tel'])){
$this->apiResponse('0','请输入手机号');
}
if(empty($data['imgCode'])){
$this->apiResponse('0','请输入图片验证码');
}
if(empty($data['code'])){
$this->apiResponse('0','请输入短信验证码');
}
if(empty($data['newPassword'])){
$this->apiResponse('0','请输入新密码');
}
if(empty($data['sureNewPassword'])){
$this->apiResponse('0','请输入确认新密码');
}
// 验证手机验证码
$where_Code['tel'] = $data['tel'];
$where_Code['type'] = 2;
$code = Db::name('Code')->where($where_Code)->order('create_time desc')->find();
if($code['code'] != $data['code']){
$this->apiResponse('0','短信验证码错误');
}
$where_tel['tel'] = $data['tel'];
$is_isset = Db::name('Member')->where($where_tel)->field('id')->find();
if(!$is_isset){
$this->apiResponse('0','该手机号暂未注册');
}
if($data['newPassword'] == $data['sureNewPassword']){
$where_update['tel'] = $data['tel'];
$middleStr = rand(1000,9999).time().rand(100,999);
$update['token'] = $this->md5($middleStr);
$update['password'] = $this->md5($data['newPassword']);
$is_update = Db::name('Member')->where($where_update)->update($update);
if($is_update){
$this->apiResponse('1','成功',$update['token']);
}else{
$this->apiResponse('0','修改失败');
}
}else{
$this->apiResponse('0','两次密码输入不一致');
}
}else{
// 返回验证码图片
$img = $this->getImgUrl();
$this->apiResponse('1','成功',$img);
}
}
/**
* @title 绑定银行卡
* @description 接口说明
* @author 开发者
* @url /api/portal/User/myCard
* @method POST
* @param name:token type:int require:1 default: other: desc:token
* @param name:card_name type:int require:1 default: other: desc:银行名称
* @param name:card_num type:int require:1 default: other: desc:银行卡号
*/
public function myCard(Request $request){
$data = $request->param();
$where_member['token'] = $data['token'];
$where_member['status'] = 1;
$member = Db::name('Member')->where($where_member)->field('id,name,tel')->find();
if(!empty($data['card_num'])){
// 验证码
$where_code['type'] = 5;
$code = Db::name('Code')->where($where_code)->order('create_time desc')->limit(1)->find();
if($code != $data['code']){
$this->apiResponse('0','验证码错误');
}
$add['card_name'] = $data['card_name'];
$add['card_num'] = $data['card_num'];
$add['create_time'] = time();
$add['update_time'] = time();
$add['user_id'] = $member['id'];
$add_final = Db::name('Card')->insertGetId($add);
if($add_final){
$this->apiResponse('1','成功',$add_final);
}else{
$this->apiResponse('0','添加失败');
}
}else{
$this->apiResponse('1','成功',$member);
}
}
/**
* @title 银行卡解除绑定
* @description 接口说明
* @author 开发者
* @url /api/portal/User/delMyCard
* @method POST
* @param name:token type:int require:1 default: other: desc:token
* @param name:card_id type:int require:1 default: other: desc:银行id
*/
public function delMyCard(Request $request){
$data = $request->param();
$where_mem['token'] = $data['token'];
$where_mem['status'] = 1;
$user_id = Db::name('Member')->where($where_mem)->field('id')->find();
$where_card['status'] = 1;
$where_card['user_id'] = $user_id['id'];
$where_card['id'] = $data['card_id'];
$card = Db::name('Card')->where($where_card)->find();
if($card){
$save['status'] = 9;
$save['create_time'] = time();
$where_cardNext['id'] = $data['card_id'];
$card = Db::name('Card')->where($where_cardNext)->update($save);
if($card){
$this->apiResponse('1','成功');
}else{
$this->apiResponse('0','解除绑定失败');
}
}else{
$this->apiResponse('0','解除绑定失败');
}
}
/**
* @title 用户个人中心首页(over)
* @description 接口说明
* @author 开发者
* @url /api/portal/User/myIndex
* @method POST
* @param name:token type:int require:1 default: other: desc:token
*/
public function myIndex(Request $request){
$token = $request->param('token');
$where_member['token'] = $token;
$where_member['status'] = 1;
$member = Db::name('Member')->where($where_member)->field('tel,id')->find();
if(!$member){
$this->apiResponse('0','用户信息错误');
}
$final['user'] = $member;
$where_userNeed['user_id'] = $member['id'];
$user_need = Db::name('UserNeed')->where($where_userNeed)->order('create_time desc')->select();
if($user_need){
$final['user_need'] = $user_need;
}else{
$final['user_need'] = array();
}
$this->apiResponse('1','成功',$final);
}
// 用户信息
public function myleft($token){
$where_member['token'] = $token;
$where_member['status'] = 1;
$member = Db::name('Member')->where($where_member)->field('tel,id,name,referee_tel')->find();
if(!$member){
$this->apiResponse('0','用户信息错误');
}
return $member;
}
/**
* @title 用户个人中心我的比价/比价详情(over)
* @description 接口说明
* @author 开发者
* @url /api/portal/User/myIndex
* @method POST
* @param name:token type:int require:1 default: other: desc:token
* @return data:''@
* @data status:'状态(1->待发布,2->已发布,待报价,3->已成交,4->未交保证金,5->已过期,6->未选择中介,7->中介未确认,8->报价人数不足,9->删除)'
*/
public function myNeed(Request $request){
$token = $request->param('token');
$member = $this->myleft($token);
$final['user'] = $member;
$where_userNeed['user_id'] = $member['id'];
$where_userNeed['status'] = array('neq',9);
$user_need = Db::name('UserNeed')->where($where_userNeed)->order('create_time desc')->select();
if($user_need){
$final['user_need'] = $user_need;
}else{
$final['user_need'] = array();
}
$final['user'] = $member;
$this->apiResponse('1','成功',$final);
}
/**
* @title 我的比价明细
* @description 接口说明
* @author 开发者
* @url /api/portal/User/compareDetail
* @method POST
* @param name:token type:int require:1 default: other: desc:token
* @param name:need_id type:int require:1 default: other: desc:需求id
*/
public function compareDetail(Request $request){
$token = $request->param('token');
$member = $this->myleft($token);
$data = $request->param();
$where_need['id'] = $data['need_id'];
$where_need['user_id'] = $member['id'];
$where_need['status'] = 5;
$userNeed = Db::name('UserNeed')->where($where_need)->find();
$final['need'] = $userNeed;
$final['user'] = $member;
if($userNeed){
// 查询报价
$where_agency['need_id'] = $data['need_id'];
$where_agency['status'] = 4;
$agency = Db::name('Agency')->alias('a')
->where($where_agency)
->join("hp_Member m", 'm.id = a.agency_id')
->field('a.*,a.id as agency_id,
m.id as user_id,m.name,m.company,m.store,m.tel,m.reputation,m.start')
->select()->toArray();
if($agency){
$final['agency'] = $agency;
$this->apiResponse('1','成功',$final);
}else{
$this->apiResponse('0','中介报价有误');
}
}else{
$this->apiResponse('0','当前状态不支持查看报价');
}
}
/**
* @title 我的资料
* @description 接口说明
* @author 开发者
* @url /api/portal/User/myMes
* @method POST
* @param name:token type:int require:1 default: other: desc:token
* @param name:need_id type:int require:1 default: other: desc:需求id
* @param name:agency_id type:int require:1 default: other: desc:中介报价id
* @return data:''@
*/
public function myMes(Request $request){
$data = $request->param();
$user = $this->myleft($data['token']);
// $where_member['status'] = 1;
// $where_member['id'] = $user['id'];
// $member = Db::name('Member')->where($where_member)->field('referee_tel')->find();
$where_card['status'] = 1;
$where_card['user_id'] = $user['id'];
$card = Db::name('Card')->where($where_card)->field('referee_tel')->find();
$final['card'] = $card;
$final['user'] = $user;
if($card){
$this->apiResponse('1','成功',$final);
}else{
$this->apiResponse('0','失败');
}
}
/**
* @title 确认成交
* @description 接口说明
* @author 开发者
* @url /api/portal/User/sureAgency
* @method POST
* @param name:token type:int require:1 default: other: desc:token
* @param name:need_id type:int require:1 default: other: desc:需求id
* @param name:agency_id type:int require:1 default: other: desc:中介报价id
* @return data:''@
*/
public function sureAgency(Request $request){
$data = $request->param();
if(!$data['need_id'] || !$data['agency_id'] ){
$this->apiResponse('0','参数错误');
}
$where_bid['need_id'] = $data['need_id'];
$where_bid['id'] = $data['agency_id'];
$where_bid['status'] = 4;
$is_isset = Db::name('Agency')->where($where_bid)->find();
if($is_isset){
$where_ag['id'] = $data['agency_id'];
$add['status'] = 5;
$add['update_time'] = time();
$save = Db::name('Agency')->where($where_ag)->update($add);
if($save){
$this->apiResponse('1','操作失败');
}else{
$this->apiResponse('0','成交失败');
}
}else{
$this->apiResponse('0','报价选择有误');
}
}
/**
* @title 查看评价
* @description 接口说明
* @author 开发者
* @url /api/portal/User/comment
* @method POST
* @param name:token type:int require:1 default: other: desc:token
* @param name:agency_id type:int require:1 default: other: desc:中介id
*/
public function comment(Request $request){
$data = $request->param();
$where_isset['id'] = $data['agency_id'];
$agency_id = Db::name('Member')->where($where_isset)->field('id,name,pic,reputation,start')->find();
if($agency_id){
$where_comment['c.agency_id'] = $agency_id['id'];
$where_comment['c.status'] = 1;
$comment = Db::name('Comment')->alias('c')
->where($where_comment)
->join("hp_member m",'m.id = c.user_id')
->field('m.tel , c.content,c.create_time')
->select()->toArray();
if($comment){
foreach ($comment as $ck=>$cv){
$middle = str_split($cv['tel'],3);
$comment[$ck]['tel'] = $middle[0].'********';
}
$this->apiResponse('1','成功',$comment);
}else{
$this->apiResponse('1','暂无评价');
}
}else{
$this->apiResponse('0','中介不存在');
}
}
/**
* @title 投诉
* @description 接口说明
* @author 开发者
* @url /api/portal/User/complaint
* @method POST
* @param name:token type:int require:1 default: other: desc:token
* @param name:need_id type:int require:1 default: other: desc:需求id
* @param name:agency_id type:int require:1 default: other: desc:中介报价id
* @param name:intermediary_id type:int require:1 default: other: desc:中介id
* @param name:content type:int require:1 default: other: desc:投诉内容
* @param name:type type:int require:1 default: other: desc:1->用户投诉,2->中介投诉
*/
public function complaint(Request $request){
$token = $request->param('token');
$member = $this->myleft($token);
$final['user'] = $member;
$data = $request->param();
$where_isset['user_id'] = $member['id'];
$where_isset['need_id'] = $data['need_id'];
$where_isset['agency_id'] = $data['agency_id'];
$where_isset['intermediary_id'] = $data['intermediary_id'];
$is_isset= Db::name('Complaint')->where($where_isset)->field('id')->find();
if($is_isset){
$this->apiResponse('0','您已投诉');
}
$add['user_id'] = $member['id'];
$add['need_id'] = $data['need_id'];
$add['agency_id'] = $data['agency_id'];
$add['intermediary_id'] = $data['intermediary_id'];
$add['content'] = $data['content'];
$add['type'] = $data['type'];
$is_add = Db::name('Complaint')->insertGetId($add);
if($is_add){
$final['complaint_id'] = $is_add;
$this->apiResponse('1','投诉成功',$final);
}else{
$this->apiResponse('0','投诉失败');
}
}
/**
* @title 我的账户
* @description 接口说明
* @author 开发者
* @url /api/portal/User/orderDetail
* @method POST
* @param name:token type:int require:1 default: other: desc:token
*/
public function orderDetail(Request $request){
$data = $request->param();
$get_msg = $this->myleft($data['token']);
$where_order['user_id'] = $get_msg['id'];
$where_order['status'] = array('neq',9);
$order_list = Db::name('UsermoneyDetail')->where($where_order)->select()->toArray();
if($order_list){
foreach ($order_list as $ok=>$ov){
}
}else{
$result = array();
}
}
}
... ...
<?php
// +----------------------------------------------------------------------
// | ThinkCMF [ WE CAN DO IT MORE SIMPLE ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013-2017 http://www.thinkcmf.com All rights reserved.
// +----------------------------------------------------------------------
// | Author: wuwu <15093565100@163.com>
// +----------------------------------------------------------------------
namespace api\portal\controller;
use api\portal\model\MemberModel;
use api\portal\model\PortalPostModel;
use cmf\controller\RestBaseController;
use think\Db;
use think\Request;
use think\Loader;
use think\Config;
use think\captcha\Captcha;
use think\Url;
use SmsDemo;
//use think\Route;
/**
* @title 用户接口
* @description 接口说明
* @group 接口分组
*/
class UserNeedController extends CommonController
{
protected $postModel;
public function __construct(PortalPostModel $postModel)
{
parent::__construct();
$this->postModel = $postModel;
}
/**
* @title 用户发布需求的保证金
* @description 接口说明
* @author 开发者
* @url /api/portal/UserNeed/payMoney
* @method POST
* @param name:city type:int require:1 default: other: desc:地区
* @param name:quarters type:int require:1 default: other: desc:小区
* @param name:password type:int require:1 default: other: desc:密码
*/
public function payMoney(Request $request){
$data = $request->param();
if(!$data['city'] || !$data['area'] ){
$this->apiResponse('0','城市、面积不能为空');
}
$city = $data['city'];
$area = $data['area'];
}
/**
* @title 用户发布需求
* @description 接口说明
* @author 开发者
* @url /api/portal/UserNeed/send
* @method POST
* @param name:city type:int require:1 default: other: desc:地区
* @param name:quarters type:int require:1 default: other: desc:小区
* @param name:password type:int require:1 default: other: desc:密码
*/
public function send(Request $request)
{
if($request->Post()){
$data = $request->param();
// 判空,处理
// 加数据库
}else{
// 问答内容
$where_pro['status'] = 1;
$list = Db::name('NeedAnswer')->where($where_pro)->order("update_time desc")->find();
if($list){
$this->apiResponse('1','成功',$list);
}else{
$this->apiResponse('0','暂无内容');
}
}
}
}
<?php
// +----------------------------------------------------------------------
// | ThinkCMF [ WE CAN DO IT MORE SIMPLE ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013-2017 http://www.thinkcmf.com All rights reserved.
// +----------------------------------------------------------------------
// | Author: wuwu <15093565100@163.com>
// +----------------------------------------------------------------------
namespace api\portal\controller;
use api\portal\model\UserNeedModel;
use api\portal\model\PortalPostModel;
use cmf\controller\RestBaseController;
use think\Db;
use think\Request;
use think\Loader;
use think\Config;
use think\captcha\Captcha;
use think\Url;
use SmsDemo;
//use think\Route;
/**
* @title 用户需求接口
* @description 接口说明
* @group 接口分组
*/
class UserneedController extends CommonController
{
protected $postModel;
public function __construct(PortalPostModel $postModel)
{
parent::__construct();
$this->postModel = $postModel;
}
/**
* @title 用户发布需求时保证金金额(填完地区,小区调用;每次修改重新调用)
* @description 接口说明
* @author 开发者
* @url /api/portal/UserNeed/payMoney
* @method POST
* @param name:city type:int require:1 default: other: desc:地区
* @param name:area type:int require:1 default: other: desc:面积
*/
public function payMoney(Request $request){
$data = $request->param();
if(!$data['city'] || !$data['area'] ){
$this->apiResponse('0','城市、面积不能为空');
}
$city = $data['city'];
$area = $data['area'];
// 查询地区
$where_area['area_name'] = array('like',"%$city%");
// $where_area['parent_id'] = 0;
$city_id = Db::name('Areas')->where($where_area)->field('area_id')->find();
$where_money['city'] = array('like',"%".$city_id['area_id'].'%');
$where_money['status'] = 1;
$where_money['low_area'] = array('lt',$area);
$where_money['height_area'] = array('egt',$area);
$money = Db::name('MoneyRule')->where($where_money)->field('money')->find();
if(!$money){
$where_elsemoney['city'] = 0;
$where_elsemoney['status'] = 1;
$where_elsemoney['low_area'] = array('lt',$area);
$where_elsemoney['height_area'] = array('egt',$area);
$elsemoney = Db::name('MoneyRule')->where($where_elsemoney)->field('money')->find();
if($elsemoney){
$this->apiResponse('1','成功',$elsemoney['money']);
}else{
$this->apiResponse('0','保证金获取失败');
}
}else{
$this->apiResponse('1','成功',$money['money']);
}
}
/**
* @title 用户发布需求
* @description 接口说明
* @author 开发者
* @url /api/portal/UserNeed/send
* @method POST
* @param name:city type:varchar require:1 default: other: desc:地区(省-市-区)
* @param name:quarters type:varchar require:1 default: other: desc:小区
* @param name:room type:varchar require:1 default: other: desc:具体房号(1-1-1)
* @param name:floor type:int require:1 default: other: desc:楼层
* @param name:house_type type:varchar require:1 default: other: desc:户型
* @param name:renovation type:varchar require:1 default: other: desc:装修
* @param name:area type:varchar require:1 default: other: desc:建筑面积
* @param name:is_first type:tinyint require:1 default: other: desc:是否首套房(1->首套房,2->两套及以上)
* @param name:loan type:tinyint require:1 default: other: desc:贷款(1->贷款,2->全款)
* @param name:contract type:tinyint require:1 default: other: desc:是否是包干价(1->是,2->否)
* @param name:quotation_time type:int require:1 default: other: desc:报价时间
* @param name:name type:varchar require:1 default: other: desc:联系人姓名
* @param name:tel type:varchar require:1 default: other: desc:联系人电话
* @param name:code type:int require:1 default: other: desc:验证码
* @param name:else type:int require:1 default: other: desc:备注
* @param name:need_id type:int require:1 default: other:修改需求时传 desc:需求id
* @return data:''@
* @data type:'1->包干价,2->问答'
* @data need_id:'需求id'
*/
public function send(Request $request)
{
if($request->Post('token') && $request->Post('name')){
// $data = $request->param();
// 判空,处理
$validate = Loader::validate('UserNeed');
if(!$validate->check($_POST)){
return json(array('code'=>0,'msg'=>$validate->getError()));
}
// 加数据库
$data = $request->Post();
// 保证金
$city = $data['city'];
$area = $data['area'];
// 查询地区
$where_area['area_name'] = array('like',"%$city%");
$city_id = Db::name('Areas')->where($where_area)->field('area_id')->find();
$where_money['city'] = array('like',"%".$city_id['area_id'].'%');
$where_money['status'] = 1;
$where_money['low_area'] = array('lt',$area);
$where_money['height_area'] = array('egt',$area);
$money = Db::name('MoneyRule')->where($where_money)->field('money')->find();
if(!$money){
$where_elsemoney['city'] = 0;
$where_elsemoney['status'] = 1;
$where_elsemoney['low_area'] = array('lt',$area);
$where_elsemoney['height_area'] = array('egt',$area);
$elsemoney = Db::name('MoneyRule')->where($where_elsemoney)->field('money')->find();
if($elsemoney){
$data['pay_money'] = $elsemoney['money'];
}else{
$this->apiResponse('0','保证金获取失败');
}
}else{
$data['pay_money'] = $money['money'];
}
$where_mem['token'] = $data['token'];
$mem_id = Db::name('Member')->where($where_mem)->field('id')->find();
$data['user_id'] = $mem_id['id'];
$model = new UserNeedModel();
// 添加
unset($data['code']);
unset($data['connect']);
unset($data['token']);
$save = $model->save($data);
if($save){
$final['userNeed_id'] = $model->getLastInsID();
$this->apiResponse('1','添加成功',$final);
}else{
$this->apiResponse('0','添加失败');
}
}else{
// 问答内容
$where_pro['status'] = 1;
$list = Db::name('NeedAnswer')->where($where_pro)->order("update_time desc")->field("title,content,id,type")->select()->toArray();
foreach ($list as $lk=>$lv){
$list[$lk]['content'] = htmlspecialchars_decode($lv['content']);
}
if($list){
$this->apiResponse('1','成功',$list);
}else{
$this->apiResponse('0','暂无内容');
}
}
}
/**
* @title 用户修改需求
* @description 接口说明
* @author 开发者
* @url /api/portal/UserNeed/send
* @method POST
* @param name:city type:varchar require:1 default: other: desc:地区(省-市-区)
* @param name:quarters type:varchar require:1 default: other: desc:小区
* @param name:room type:varchar require:1 default: other: desc:具体房号(1-1-1)
* @param name:floor type:int require:1 default: other: desc:楼层
* @param name:house_type type:varchar require:1 default: other: desc:户型
* @param name:renovation type:varchar require:1 default: other: desc:装修
* @param name:area type:varchar require:1 default: other: desc:建筑面积
* @param name:is_first type:tinyint require:1 default: other: desc:是否首套房(1->首套房,2->两套及以上)
* @param name:loan type:tinyint require:1 default: other: desc:贷款(1->贷款,2->全款)
* @param name:contract type:tinyint require:1 default: other: desc:是否是包干价(1->是,2->否)
* @param name:quotation_time type:int require:1 default: other: desc:报价时间
* @param name:name type:varchar require:1 default: other: desc:联系人姓名
* @param name:tel type:varchar require:1 default: other: desc:联系人电话
* @param name:code type:int require:1 default: other: desc:验证码
* @param name:else type:int require:1 default: other: desc:备注
* @param name:need_id type:int require:1 default: other:修改需求时传 desc:需求id
* @return data:''@
* @data type:'1->包干价,2->问答'
* @data need_id:'需求id'
*/
public function changeSend(Request $request)
{
if($request->Post('token') && $request->Post('name')){
// $data = $request->param();
// 判空,处理
$validate = Loader::validate('UserNeed');
if(!$validate->check($_POST)){
return json(array('code'=>0,'msg'=>$validate->getError()));
}
// 加数据库
$data = $request->Post();
// 保证金
$city = $data['city'];
$area = $data['area'];
// 查询地区
$where_area['area_name'] = array('like',"%$city%");
$city_id = Db::name('Areas')->where($where_area)->field('area_id')->find();
$where_money['city'] = array('like',"%".$city_id['area_id'].'%');
$where_money['status'] = 1;
$where_money['low_area'] = array('lt',$area);
$where_money['height_area'] = array('egt',$area);
$money = Db::name('MoneyRule')->where($where_money)->field('money')->find();
if(!$money){
$where_elsemoney['city'] = 0;
$where_elsemoney['status'] = 1;
$where_elsemoney['low_area'] = array('lt',$area);
$where_elsemoney['height_area'] = array('egt',$area);
$elsemoney = Db::name('MoneyRule')->where($where_elsemoney)->field('money')->find();
if($elsemoney){
$data['pay_money'] = $elsemoney['money'];
}else{
$this->apiResponse('0','保证金获取失败');
}
}else{
$data['pay_money'] = $money['money'];
}
$where_mem['token'] = $data['token'];
$mem_id = Db::name('Member')->where($where_mem)->field('id')->find();
$data['user_id'] = $mem_id['id'];
$model = new UserNeedModel();
// 修改
$where_need['userNeed_id'] = $request->param('need_id');
$where_need['status'] = 1;
$need = Db::name('UserNeed')->where($where_need)->find();
if(!$need){
$this->apiResponse('0','该需求不可修改');
}else{
unset($data['code']);
unset($data['connect']);
unset($data['token']);
$data['id'] = $data['need_id'];
$save = $model->isUpdate(true)->allowField(true)->save($data);
}
if($save){
$final['need_id'] = $model->getLastInsID();;
$this->apiResponse('1','添加成功',$final);
}else{
$this->apiResponse('0','添加失败');
}
}else{
$data = $request->param();
$where_need['id'] = $request->param('need_id');
$where_need['status'] = 1;
$where_mem['token'] = $data['token'];
$mem_id = Db::name('Member')->where($where_mem)->field('id')->find();
$where_need['user_id'] = $mem_id['id'];
$list['need'] = Db::name('UserNeed')->where($where_need)->find();
if(!$list['need']){
$this->apiResponse('0','该需求不可修改');
}
// 问答内容
$where_pro['status'] = 1;
$list['list'] = Db::name('NeedAnswer')->where($where_pro)->order("update_time desc")->field("title,content,id,type")->select()->toArray();
foreach ($list as $lk=>$lv){
$list[$lk]['content'] = htmlspecialchars_decode($lv['content']);
}
if($list){
$this->apiResponse('1','成功',$list);
}else{
$this->apiResponse('0','暂无内容');
}
}
}
// 发布需求支付
public function needPay(Request $request){
// 添加订单
Db::startTrans();
$data = $request->param();
if(!$data['need_id']){
$this->apiResponse('0','需求不能为空');
}
// 查询金额
$where_need['id'] = $data['need_id'];
$where_need['status'] = 1;
$should_pay = Db::name('UserNeed')->where($where_need)->field('pay_money')->find();
if(!$should_pay){
$this->apiResponse('0','需求错误');
}else{
if(!$should_pay['pay_money']){
$this->apiResponse('0','诚意金金额有误');
}
}
// 拼字度
$add['need_id'] = $data['need_id'];
$add['money'] = $should_pay['pay_money'];
$add['name'] = '诚意金缴纳';
$add['type'] = 1;
$add['is_get'] = 2;
$add['status'] = 1;
// 加入数据库
$model = new OrderModel();
$save = $model->save($add);
if($save){
Db::commit();
}else{
Db::rollback();
}
// 支付(未完)
echo "<pre/>";
print_r('3333');
die;
// 更改订单状态
// 成功
$update['pay_time'] = time();
$update['status'] = time();
$update = $model->isUpdate(true)->allowField(true)->save($update);
if($update){
$this->apiResponse('1','支付成功');
}
}
}
... ...
<?php
// +----------------------------------------------------------------------
// | ThinkCMF [ WE CAN DO IT MORE SIMPLE ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013-2018 http://www.thinkcmf.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: 老猫 <thinkcmf@126.com>
// +----------------------------------------------------------------------
namespace api\portal\model;
//use api\admin\model\RouteModel;
use think\Model;
class AgencyModel extends Model
{
protected $autoWriteTimestamp = true;
}
\ No newline at end of file
... ...
<?php
// +----------------------------------------------------------------------
// | ThinkCMF [ WE CAN DO IT MORE SIMPLE ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013-2018 http://www.thinkcmf.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: 老猫 <thinkcmf@126.com>
// +----------------------------------------------------------------------
namespace api\portal\model;
//use api\admin\model\RouteModel;
use think\Model;
class CodeModel extends Model
{
protected $autoWriteTimestamp = true;
}
\ No newline at end of file
... ...
<?php
// +----------------------------------------------------------------------
// | ThinkCMF [ WE CAN DO IT MORE SIMPLE ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013-2018 http://www.thinkcmf.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: 老猫 <thinkcmf@126.com>
// +----------------------------------------------------------------------
namespace api\portal\model;
//use api\admin\model\RouteModel;
use think\Model;
class OrderModel extends Model
{
protected $autoWriteTimestamp = true;
}
\ No newline at end of file
... ...
<?php
// +----------------------------------------------------------------------
// | ThinkCMF [ WE CAN DO IT MORE SIMPLE ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013-2018 http://www.thinkcmf.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: 老猫 <thinkcmf@126.com>
// +----------------------------------------------------------------------
namespace api\portal\model;
//use api\admin\model\RouteModel;
use think\Model;
class UserNeedModel extends Model
{
protected $autoWriteTimestamp = true;
}
\ No newline at end of file
... ...
... ... @@ -7,6 +7,7 @@ Route::get('portal/categories/subCategories', 'portal/Categories/subCategories')
Route::resource('portal/articles', 'portal/Articles');
Route::resource('portal/pages', 'portal/Pages');
Route::resource('portal/userArticles', 'portal/UserArticles');
Route::resource('portal/IntermediaryNeed', 'portal/IntermediaryNeed');
Route::get('portal/search', 'portal/Articles/search');
Route::get('portal/articles/my', 'portal/Articles/my');
... ...
... ... @@ -12,27 +12,21 @@ namespace api\portal\validate;
use think\Validate;
class IntermediaryValidate extends Validate
class IntermediaryNeedValidate extends Validate
{
protected $rule = [
'name' => ['require','length:2,4','chs'],
'password' => ['require','length:6,16'],
'tel' => ['regex'=>'/13[123569]{1}\d{8}|15[1235689]\d{8}|188\d{8}/','require'],
'need_id' => 'require',
'housing_price' => 'require',
];
protected $message = [
'name.require' => '姓名不能为空!',
'name.length' => '姓名为2-4个汉字!',
'name.chs' => '姓名只能是汉字!',
'tel.require' => '手机号不能为空!',
'tel.regex' => '手机号格式不正确!',
'password.require' => '密码不能为空!',
'password.length' => '密码长度为6-16位!',
'need_id.require' => '需求id不能为空!',
'housing_price.require' => '房价不能为空!',
];
protected $scene = [
'add' => ['name','tel','password'],
'edit' => ['tel','password','name'],
'offer' => ['need_id','housing_price'],
];
}
\ No newline at end of file
... ...
<?php
// +----------------------------------------------------------------------
// | ThinkCMF [ WE CAN DO IT MORE SIMPLE ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013-2018 http://www.thinkcmf.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: 小夏 < 449134904@qq.com>
// +----------------------------------------------------------------------
namespace api\portal\validate;
use think\Validate;
class UserNeedValidate extends Validate
{
protected $rule = [
'city' => 'require',
'quarters' => 'require',
// 'room' => 'require',
// 'floor' => 'require',
'house_type' => 'require',
'renovation' => 'require',
'area' => 'require',
'is_first' => 'require',
'loan' => 'require',
'quotation_time' => 'require',
'name' => 'require',
'tel' => 'require',
'code' => 'require',
'contract' => 'require',
];
protected $message = [
'city.require' => '地区不能为空!',
'quarters.require' => '小区不能为空!',
// 'room.length' => '房号不能为空!',
// 'floor.length' => '楼层不能为空!',
'house_type.require' => '户型不能为空!',
'renovation.require' => '装修不能为空!',
'area.require' => '建筑面积不能为空!',
'is_first.require' => '是否首套房不能为空!',
'loan.require' => '贷款不能为空!',
'quotation_time.require' => '报价时间不能为空!',
'name.require' => '联系人姓名不能为空!',
'tel.require' => '联系人电话不能为空!',
'code.require' => '验证码不能为空!',
'contract.require' => '请选择是否包干价!',
];
protected $scene = [
];
}
\ No newline at end of file
... ...
... ... @@ -18,7 +18,12 @@ class UserValidate extends Validate
'name' => ['require','length:2,4','chs'],
'password' => ['require','length:6,16'],
'tel' => ['regex'=>'/13[123569]{1}\d{8}|15[1235689]\d{8}|18\d{9}/','require'],
'sure_password' => 'require'
'sure_password' => 'require',
'city' => 'require',
'company' => 'require',
'store' => 'require',
'quarters' => 'require',
];
protected $message = [
'name.require' => '姓名不能为空!',
... ... @@ -30,11 +35,18 @@ class UserValidate extends Validate
'password.length' => '密码长度为6-16位!',
'sure_password.require' => '确认密码不能为空!',
'city.require' => '城市不能为空!',
'company.require' => '所属公司不能为空!',
'store.require' => '门店不能为空!',
'quarters.require' => '服务小区不能为空!',
];
protected $scene = [
'add' => ['name','tel','password','sure_password'],
'edit' => ['tel','password','name','sure_password'],
// 'add' => ['name','tel','password','sure_password'],
// 'edit' => ['tel','password','name','sure_password'],
'user' => ['tel','password','name','sure_password'],
'intermediary' => ['tel','password','name','sure_password','city','company','store','quarters'],
];
}
\ No newline at end of file
... ...
<?php
// +----------------------------------------------------------------------
// | ThinkCMF [ WE CAN DO IT MORE SIMPLE ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013-2018 http://www.thinkcmf.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: 老猫 <thinkcmf@126.com>
// +----------------------------------------------------------------------
namespace app\portal\controller;
use app\portal\model\BrandModel;
use app\portal\model\CooperationModel;
use app\portal\model\ProcessModel;
use cmf\controller\AdminBaseController;
use app\portal\model\PortalTagModel;
use app\portal\service\PostService;
use think\Db;
use think\Request;
use think\Loader;
class BrandController extends AdminBaseController
{
/**
* 列表(暂无用)
* @adminMenu(
* 'name' => '文章管理',
* 'parent' => 'portal/AdminIndex/default',
* 'display'=> true,
* 'hasView'=> true,
* 'order' => 10000,
* 'icon' => '',
* 'remark' => '文章列表',
* 'param' => ''
* )
*/
public function index(Request $request)
{
$where_coo['status'] = 1;
// $where_coo = array();
if($request->post()){
$search = $request->post();
if($search['start_time']){
$start = strtotime($search['start_time']);
if($search['end_time']){
$end = strtotime($search['end_time']);
}else{
$end = time();
}
$where_coo['update_time'] = array('between',"$start,$end");
$this->assign('start_time',date('Y-m-d H:i',$start));
$this->assign('end_time',date('Y-m-d H:i',$end));
}
if($search['keyword']){
$where_coo['name'] = array('like',"%".$search['keyword']."%");
$this->assign('keyword',$search['keyword']);
}
}
$coo_list = Db::name('Brand')->where($where_coo)->order('score desc , create_time desc')->select()->toArray();
$this->assign('list',$coo_list);
return $this->fetch();
}
/**
* 添加、修改
* @adminMenu(
* 'name' => '添加文章',
* 'parent' => 'index',
* 'display'=> false,
* 'hasView'=> true,
* 'order' => 10000,
* 'icon' => '',
* 'remark' => '添加文章',
* 'param' => ''
* )
*/
public function add(Request $request)
{
if($request->post()){
// 添加数据
$data = $request->post();
if($request->Post('id')){
// 修改
$add['name'] = $data['name'];
$add['score'] = $data['score'];
$validate = Loader::validate('Brand');
if(!$validate->scene('edit')->check($add)){
$mes = $validate->getError();
$this->error("$mes");
}
$add['id'] = $request->param('id');
$model = new BrandModel();
$final = $model->isUpdate(true)->allowField(true)->save($add);
}else{
// 添加
$add['name'] = $data['name'];
$add['score'] = $data['score'];
$validate = Loader::validate('Brand');
if(!$validate->scene('add')->check($add)){
$mes = $validate->getError();
$this->error("$mes");
}
$model = new BrandModel();
$final = $model->save($add);
}
if($final){
$this->success('成功',url('index'));
}else{
$this->error('失败');
}
}else{
$where_find['id'] = $request->param('id');
$list = Db::name('Brand')->where($where_find)->find();
$this->assign('list',$list);
return $this->fetch('add');
}
}
// 删除
public function del(Request $request){
$ids = $this->request->post();
$id = $request->param('id');
if($ids){
$add_del['id'] = array('in',$ids['ids']);
}else if($id){
$add_del['id'] = $request->param('id');
}else{
$this->error('删除失败');
}
$add_del['status'] = 9;
$model = new BrandModel();
$del = $model->isUpdate(true)->allowField(true)->save($add_del);
if($del){
$this->success('删除成功',url('index'));
}else{
$this->error('删除失败');
}
}
}
... ...
... ... @@ -57,13 +57,28 @@ class MoneyController extends AdminBaseController
$this->assign('keyword',$search['keyword']);
}
}
$coo_list = Db::name('MoneyRule')->alias('r')
->where($where_coo)
->join("hp_areas a",'a.area_id = r.city')
->field("a.area_name , r.id as id, r.low_area,r.height_area,r.money,r.create_time,r.update_time")
// ->join("hp_areas a",'a.area_id = r.city')
// ->field("a.area_name , r.id as id, r.low_area,r.height_area,r.money,r.create_time,r.update_time")
->field("r.city, r.id as id, r.low_area,r.height_area,r.money,r.create_time,r.update_time")
->order('create_time desc')
->select()->toArray();
foreach ($coo_list as $coolk=>$coolv){
$where_findarea['area_id'] = array('in',$coolv['city']);
// $where_findarea['parent_id'] = 0;
$name_arr = Db::name('Areas')->where($where_findarea)->field('area_name')->select();
$middlearr = array();
foreach ($name_arr as $namek=>$namev){
$middlearr[] = $namev['area_name'];
}
$name_str = implode(',',$middlearr);
$coo_list[$coolk]['area_name'] = $name_str;
}
$this->assign('list',$coo_list);
return $this->fetch();
}
... ... @@ -77,7 +92,7 @@ class MoneyController extends AdminBaseController
if($request->Post('id')){
// 修改
$add['low_area'] = $data['low_area'];
$add['city'] = $data['city'];
$add['city'] = implode(',',$data['city']);
$add['height_area'] = $data['height_area'];
$add['money'] = $data['money'];
$validate = Loader::validate('Money');
... ... @@ -91,7 +106,7 @@ class MoneyController extends AdminBaseController
}else{
// 添加
$add['low_area'] = $data['low_area'];
$add['city'] = $data['city'];
$add['city'] = implode(',',$data['city']);
$add['height_area'] = $data['height_area'];
$add['money'] = $data['money'];
$validate = Loader::validate('Money');
... ...
<?php
// +----------------------------------------------------------------------
// | ThinkCMF [ WE CAN DO IT MORE SIMPLE ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013-2018 http://www.thinkcmf.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: 老猫 <thinkcmf@126.com>
// +----------------------------------------------------------------------
namespace app\portal\controller;
use cmf\controller\AdminBaseController;
use app\portal\model\NeedAnswerModel;
use app\portal\model\MemberModel;
use app\portal\model\UserModel;
use app\portal\service\PostService;
use think\Db;
use think\Request;
use think\Loader;
/**
* @title 保证金内容管理
* @description 接口说明
* @group 接口分组
*/
class NeedController extends AdminBaseController
{
// 列表
public function user(Request $request)
{
$where_coo['status'] = 1;
$where_coo['type'] = 2;
// $where_coo = array();
if($request->post()){
$search = $request->post();
if($search['start_time']){
$start = strtotime($search['start_time']);
if($search['end_time']){
$end = strtotime($search['end_time']);
}else{
$end = time();
}
$where_coo['update_time'] = array('between',"$start,$end");
$this->assign('start_time',date('Y-m-d H:i',$start));
$this->assign('end_time',date('Y-m-d H:i',$end));
}
if($search['keyword']){
$where_coo['title'] = array('like',"%".$search['keyword']."%");
$this->assign('keyword',$search['keyword']);
}
}
$coo_list = Db::name('NeedAnswer')->where($where_coo)
->order('score desc , create_time desc')
->select()->toArray();
if($coo_list){
foreach ($coo_list as $k=>$v){
$coo_list[$k]['content'] = htmlspecialchars_decode($v['content']);
}
}
$this->assign('list',$coo_list);
return $this->fetch();
}
public function add(Request $request)
{
if($request->post()){
// 添加数据
$data = $request->post();
if($request->Post('id')){
// 修改
$add['content'] = $data['content'];
$add['title'] = $data['title'];
$add['score'] = $data['score'];
$add['type'] = 2;
$validate = Loader::validate('NeedAnswer');
if(!$validate->scene('edit')->check($add)){
$mes = $validate->getError();
$this->error("$mes");
}
$add['id'] = $request->param('id');
$model = new NeedAnswerModel();
$final = $model->isUpdate(true)->allowField(true)->save($add);
}else{
// 添加
$add['content'] = $data['content'];
$add['title'] = $data['title'];
$add['score'] = $data['score'];
$add['type'] = 2;
$validate = Loader::validate('NeedAnswer');
if(!$validate->scene('add')->check($add)){
$mes = $validate->getError();
$this->error("$mes");
}
$model = new NeedAnswerModel();
$final = $model->save($add);
}
if($final){
$this->success('成功',url('index'));
}else{
$this->error('失败');
}
}else{
$where_find['type'] = $request->param('id');
$list = Db::name('NeedAnswer')->where($where_find)->find();
if($list){
$list['content'] = htmlspecialchars_decode($list['content']);
}
$this->assign('list',$list);
return $this->fetch('add');
}
}
// 删除
public function del(Request $request){
$ids = $this->request->post();
$id = $request->param('id');
if($ids){
$add_del['id'] = array('in',$ids['ids']);
}else if($id){
$add_del['id'] = $request->param('id');
}else{
$this->error('删除失败');
}
$add_del['status'] = 9;
$model = new NeedAnswerModel();
$del = $model->isUpdate(true)->allowField(true)->save($add_del);
if($del){
$this->success('删除成功',url('index'));
}else{
$this->error('删除失败');
}
}
}
... ...
<?php
// +----------------------------------------------------------------------
// | ThinkCMF [ WE CAN DO IT MORE SIMPLE ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013-2018 http://www.thinkcmf.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: 老猫 <thinkcmf@126.com>
// +----------------------------------------------------------------------
namespace app\portal\model;
use app\admin\model\RouteModel;
use think\Model;
class BrandModel extends Model
{
protected $autoWriteTimestamp = true;
}
\ No newline at end of file
... ...
<?php
// +----------------------------------------------------------------------
// | ThinkCMF [ WE CAN DO IT MORE SIMPLE ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013-2018 http://www.thinkcmf.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: 小夏 < 449134904@qq.com>
// +----------------------------------------------------------------------
namespace app\portal\validate;
use think\Validate;
class BrandValidate extends Validate
{
protected $rule = [
'name' => 'require',
];
protected $message = [
'name.require' => '内容不为空!',
];
protected $scene = [
];
}
\ No newline at end of file
... ...
... ... @@ -12,6 +12,7 @@ namespace app\user\controller;
use cmf\controller\AdminBaseController;
use think\Db;
use think\Request;
class AdminOauthController extends AdminBaseController
{
... ... @@ -31,6 +32,7 @@ class AdminOauthController extends AdminBaseController
*/
public function index()
{
$oauthUserQuery = Db::name('third_party_user');
$lists = $oauthUserQuery->field('a.*,u.user_nickname,u.sex,u.avatar')->alias('a')->join('__USER__ u', 'a.user_id = u.id')->where("status", 1)->order("create_time DESC")->paginate(10);
... ... @@ -42,6 +44,50 @@ class AdminOauthController extends AdminBaseController
return $this->fetch();
}
public function user()
{
// 用户
$where_member['type'] = 1;
$lists = Db::name('Member')->where($where_member)->select()->toArray();
foreach ($lists as $lk=>$lv){
$where_referee['id'] = $lv['referee_id'];
$referee = Db::name('Member')->where($where_referee)->field('id,name')->find();
if($referee){
$lists[$lk]['referee_name'] = $referee['name'];
}else{
$lists[$lk]['referee_name'] = '';
}
}
// 获取分页显示
// $page = $lists->render();
$this->assign('lists', $lists);
// $this->assign('page', $page);
// 渲染模板输出
return $this->fetch();
}
public function intermediary()
{
// 中介
$where_member['type'] = 2;
$lists = Db::name('Member')->where($where_member)->select()->toArray();
foreach ($lists as $lk=>$lv){
$where_referee['id'] = $lv['referee_id'];
$referee = Db::name('Member')->where($where_referee)->field('id,name')->find();
if($referee){
$lists[$lk]['referee_name'] = $referee['name'];
}else{
$lists[$lk]['referee_name'] = '';
}
}
// 获取分页显示
// $page = $lists->render();
$this->assign('lists', $lists);
// $this->assign('page', $page);
// 渲染模板输出
return $this->fetch();
}
/**
* 后台删除第三方用户绑定
* @adminMenu(
... ... @@ -64,6 +110,22 @@ class AdminOauthController extends AdminBaseController
Db::name("third_party_user")->where("id", $id)->delete();
$this->success("删除成功!", "admin_oauth/index");
}
// 删除
public function del(Request $request)
{
$where_member['id'] = $request->param('id');
$is_isset = Db::name('Member')->where($where_member)->field('status')->find();
if(!$is_isset){
$this->error('用户信息错误!');
}
$save['status'] = 8;
$save['update_time'] = time();
$update = Db::name('Member')->where($where_member)->update($save);
if($update){
$this->success("删除成功!", "admin_oauth/intermediary");
}else{
$this->error('删除失败!');
}
}
}
\ No newline at end of file
... ...
#animationTipBox {
font-family: "Microsoft Yahei","微软雅黑",Arial,Tahoma;
font-size: 14px;
width: 250px;
height: auto;
background-color: #fff;
border-radius: 8px;
position: fixed;
left: 50%;
top: 50%;
margin-left: -125px;
margin-top: -85px;
z-index: 1001;
-webkit-animation: alertAnimation .3s ease-in-out 0 1;
-moz-animation: alertAnimation .3s ease-in-out 0 1;
animation: alertAnimation .3s ease-in-out 0 1
}
#sm-load {
width: 20px;
height: 20px;
padding: 0;
background: 0;
padding: 0;
position: relative;
float: left;
vertical-align: middle;
margin-right: 5px;
top: 0;
left: 0;
margin: 0;
-webkit-animation: none;
-moz-animation: none;
animation: none
}
#sm-load .load {
width: 20px;
height: 20px;
border: 0;
margin: 0 auto;
top: 0
}
#sm-load .icon_box {
margin: 0 auto
}
#sm-load .load .cirBox1,#sm-load .load .cirBox2,#sm-load .load .cirBox3 {
width: 20px;
height: 20px;
position: absolute;
left: 0;
top: 0
}
#sm-load .load .cirBox1>div,#sm-load .load .cirBox2>div,#sm-load .load .cirBox3>div {
width: 4px;
height: 4px;
border-radius: 100%;
background-color: #fff;
position: absolute
}
#sm-load .load .icon_box {
width: 20px;
height: 20px
}
#animationTipBox .icon {
position: relative;
width: 80px;
height: 80px;
border-radius: 50px;
border: 4px solid #6c3;
margin: 15px auto 5px auto
}
#animationTipBox .icon_box {
width: 80px;
height: 80px;
margin: 0 auto;
text-align: center;
position: relative
}
.tip .icon {
width: 80px;
height: 80px;
background-color: #6c3;
border-radius: 100%;
color: #fff;
font-size: 80px;
text-align: center;
line-height: 80px
}
#animationTipBox .lose .icon {
border-color: #ff9090
}
#animationTipBox .lose .icon_box {
-webkit-animation: lose_Animation .5s;
-moz-animation: lose_Animation .5s;
animation: lose_Animation .5s
}
#animationTipBox .dec_txt {
font-size: 16px;
text-align: center;
color: #666;
line-height: 26px;
height: 37px;
padding: 5px 0 10px 0
}
.success .line_short {
width: 25px;
height: 5px;
position: absolute;
left: 10px;
top: 44px;
border-radius: 4px;
background-color: #6c3;
-webkit-transform: rotate(45deg);
-moz-transform: rotate(45deg);
transform: rotate(45deg);
-webkit-animation: success_short_Animation .65s;
-moz-animation: success_short_Animation .65s;
animation: success_short_Animation .65s
}
.success .line_long {
width: 47px;
height: 5px;
position: absolute;
right: 4px;
top: 36px;
border-radius: 4px;
background-color: #6c3;
-webkit-transform: rotate(-45deg);
-moz-transform: rotate(-45deg);
transform: rotate(-45deg);
-webkit-animation: success_long_Animation .65s;
-moz-animation: success_long_Animation .65s;
animation: success_long_Animation .65s
}
.lose .line_left,.lose .line_right {
width: 47px;
height: 5px;
position: absolute;
left: 14px;
top: 37px;
border-radius: 4px;
background-color: #ff9090;
-webkit-transform: rotate(45deg);
-moz-transform: rotate(45deg);
transform: rotate(45deg)
}
.lose .line_right {
right: 11px;
top: 37px;
-webkit-transform: rotate(-45deg);
-moz-transform: rotate(-45deg);
transform: rotate(-45deg)
}
@keyframes alertAnimation {
0% {
transform: scale(0.5)
}
45% {
transform: scale(1.25)
}
80% {
transform: scale(0.95)
}
100% {
transform: scale(1)
}
}
@-webkit-keyframes alertAnimation {
0% {
-webkit-transform: scale(0.5)
}
45% {
-webkit-transform: scale(1.25)
}
80% {
-webkit-transform: scale(0.95)
}
100% {
-webkit-transform: scale(1)
}
}
@-moz-keyframes alertAnimation {
0% {
-moz-transform: scale(0.5)
}
45% {
-moz-transform: scale(1.25)
}
80% {
-moz-transform: scale(0.95)
}
100% {
-moz-transform: scale(1)
}
}
@-webkit-keyframes success_short_Animation {
0% {
width: 0;
left: 1px;
top: 19px
}
54% {
width: 0;
left: 1px;
top: 19px
}
70% {
width: 50px;
left: -4px;
top: 37px
}
84% {
width: 17px;
left: 21px;
top: 48px
}
100% {
width: 25px;
left: 14px;
top: 45px
}
}
@-moz-keyframes success_short_Animation {
0% {
width: 0;
left: 1px;
top: 19px
}
54% {
width: 0;
left: 1px;
top: 19px
}
70% {
width: 50px;
left: -4px;
top: 37px
}
84% {
width: 17px;
left: 21px;
top: 48px
}
100% {
width: 25px;
left: 14px;
top: 45px
}
}
@keyframes success_short_Animation {
0% {
width: 0;
left: 1px;
top: 19px
}
54% {
width: 0;
left: 1px;
top: 19px
}
70% {
width: 50px;
left: -4px;
top: 37px
}
84% {
width: 17px;
left: 21px;
top: 48px
}
100% {
width: 25px;
left: 14px;
top: 45px
}
}
@-webkit-keyframes success_long_Animation {
0% {
width: 0;
right: 46px;
top: 54px
}
65% {
width: 0;
right: 46px;
top: 54px
}
84% {
width: 55px;
right: 0;
top: 35px
}
100% {
width: 47px;
right: 8px;
top: 38px
}
}
@-moz-keyframes success_long_Animation {
0% {
width: 0;
right: 46px;
top: 54px
}
65% {
width: 0;
right: 46px;
top: 54px
}
84% {
width: 55px;
right: 0;
top: 35px
}
100% {
width: 47px;
right: 8px;
top: 38px
}
}
@keyframes success_long_Animation {
0% {
width: 0;
right: 46px;
top: 54px
}
65% {
width: 0;
right: 46px;
top: 54px
}
84% {
width: 55px;
right: 0;
top: 35px
}
100% {
width: 47px;
right: 8px;
top: 38px
}
}
@-webkit-keyframes lose_Animation {
0% {
-webkit-transform: scale(0.6);
opacity: .2
}
50% {
-webkit-transform: scale(0.6);
opacity: .5
}
80% {
-webkit-transform: scale(1.15);
opacity: .8
}
100% {
-webkit-transform: scale(1);
opacity: 1.0
}
}
@-moz-keyframes lose_Animation {
0% {
-moz-transform: scale(0.6);
opacity: .2
}
50% {
-moz-transform: scale(0.6);
opacity: .5
}
80% {
-moz-transform: scale(1.15);
opacity: .8
}
100% {
-moz-transform: scale(1);
opacity: 1.0
}
}
@keyframes lose_Animation {
0% {
transform: scale(0.6);
opacity: .2
}
50% {
transform: scale(0.6);
opacity: .5
}
80% {
transform: scale(1.15);
opacity: .8
}
100% {
transform: scale(1);
opacity: 1.0
}
}
@-webkit-keyframes load_Animation {
0% {
-webkit-transform: scale(0.6);
opacity: .2
}
50% {
-webkit-transform: scale(0.6);
opacity: .5
}
80% {
-webkit-transform: scale(1.15);
opacity: .8
}
100% {
-webkit-transform: scale(1);
opacity: 1.0
}
}
@-moz-keyframes load_Animation {
0% {
-moz-transform: scale(0.6);
opacity: .2
}
50% {
-moz-transform: scale(0.6);
opacity: .5
}
80% {
-moz-transform: scale(1.15);
opacity: .8
}
100% {
-moz-transform: scale(1);
opacity: 1.0
}
}
@keyframes load_Animation {
0% {
transform: scale(0.6);
opacity: .2
}
50% {
transform: scale(0.6);
opacity: .5
}
80% {
transform: scale(1.15);
opacity: .8
}
100% {
transform: scale(1);
opacity: 1.0
}
}
.load {
position: relative;
width: 60px;
height: 80px;
border-radius: 50px;
border: 4px solid #fff;
margin: 15px auto 5px auto;
top: 10px
}
.load .icon_box {
margin: 10px auto;
width: 60px;
height: 60px
}
.load .cirBox1,.load .cirBox2,.load .cirBox3 {
width: 60px;
height: 60px;
position: absolute;
left: 0;
top: 0
}
.load .cirBox1>div,.load .cirBox2>div,.load .cirBox3>div {
width: 10px;
height: 10px;
border-radius: 100%;
background-color: #ccc;
position: absolute
}
.load .cirBox1 {
-webkit-transform: rotate(30deg);
-moz-transform: rotate(30deg);
transform: rotate(30deg)
}
.load .cirBox2 {
-webkit-transform: rotate(60deg);
-moz-transform: rotate(60deg);
transform: rotate(60deg)
}
.load .cirBox3 {
-webkit-transform: rotate(90deg);
-moz-transform: rotate(90deg);
transform: rotate(90deg)
}
.load .cir1 {
left: 0;
top: 0
}
.load .cir2 {
right: 0;
top: 0
}
.load .cir3 {
right: 0;
bottom: 0
}
.load .cir4 {
left: 0;
bottom: 0
}
.load .cir1,.load .cir2,.load .cir3,.load .cir4 {
-webkit-animation: cir_Animation 1.2s ease 0 infinite;
-moz-animation: cir_Animation 1.2s ease 0 infinite;
animation: cir_Animation 1.2s ease 0 infinite
}
.cirBox1 .cir2 {
-webkit-animation-delay: -1.1s;
-moz-animation-delay: -1.1s;
animation-delay: -1.1s
}
.cirBox1 .cir3 {
-webkit-animation-delay: -0.8s;
-moz-animation-delay: -0.8s;
animation-delay: -0.8s
}
.cirBox1 .cir4 {
-webkit-animation-delay: -0.5s;
-moz-animation-delay: -0.5s;
animation-delay: -0.5s
}
.cirBox2 .cir2 {
-webkit-animation-delay: -1.0s;
-moz-animation-delay: -1.0s;
animation-delay: -1.0s
}
.cirBox2 .cir3 {
-webkit-animation-delay: -0.7s;
-moz-animation-delay: -0.7s;
animation-delay: -0.7s
}
.cirBox2 .cir4 {
-webkit-animation-delay: -0.4s;
-moz-animation-delay: -0.4s;
animation-delay: -0.4s
}
.cirBox3 .cir2 {
-webkit-animation-delay: -0.9s;
-moz-animation-delay: -0.9s;
animation-delay: -0.9s
}
.cirBox3 .cir3 {
-webkit-animation-delay: -0.6s;
-moz-animation-delay: -0.6s;
animation-delay: -0.6s
}
.cirBox3 .cir4 {
-webkit-animation-delay: -0.3s;
-moz-animation-delay: -0.3s;
animation-delay: -0.3s
}
@-webkit-keyframes cir_Animation {
0%,80%,100% {
-webkit-transform: scale(0.4)
}
40% {
-webkit-transform: scale(1.0)
}
}
.mask {
width: 100%;
height: 100%;
background-color: #000;
opacity: .8;
position: fixed;
left: 0;
top: 0;
z-index: 1000
}
#animationTipBox .okoButton {
width: 80px;
display: block;
height: 35px;
margin: 0 auto;
border: 0;
padding: 0;
border-radius: 5px;
background: #6c3;
color: #fff;
font-size: 22px;
}
#animationTipBox .redOkoButton {
background: #ff9090
}
\ No newline at end of file
... ...
/*
* @弹出提示层 ( 加载动画(load), 提示动画(tip), 成功(success), 错误(error), )
* @method tipBox
* @description 默认配置参数
* @time 2014-12-19
* @param {Number} width -宽度
* @param {Number} height -高度
* @param {String} str -默认文字
* @param {Object} windowDom -载入窗口 默认当前窗口
* @param {Number} setTime -定时消失(毫秒) 默认为0 不消失
* @param {Boolean} hasMask -是否显示遮罩
* @param {Boolean} hasMaskWhite -显示白色遮罩
* @param {Boolean} clickDomCancel -点击空白取消
* @param {Function} callBack -回调函数 (只在开启定时消失时才生效)
* @param {Function} hasBtn -显示按钮
* @param {String} type -动画类型 (加载,成功,失败,提示)
* @example
* new TipBox();
* new TipBox({type:'load',setTime:1000,callBack:function(){ alert(..) }});
*/
function TipBox(cfg){
this.config = {
width : 250,
height : 170,
str : '正在处理',
windowDom : window,
setTime : 0,
hasMask : true,
hasMaskWhite : false,
clickDomCancel : false,
callBack : null,
hasBtn : false,
type : 'success'
}
$.extend(this.config,cfg);
//存在就retrun
if(TipBox.prototype.boundingBox) return;
//初始化
this.render(this.config.type);
return this;
};
//外层box
TipBox.prototype.boundingBox = null;
//渲染
TipBox.prototype.render = function(tipType,container){
this.renderUI(tipType);
//绑定事件
this.bindUI();
//初始化UI
this.syncUI();
$(container || this.config.windowDom.document.body).append(TipBox.prototype.boundingBox);
};
//渲染UI
TipBox.prototype.renderUI = function(tipType){
TipBox.prototype.boundingBox = $("<div id='animationTipBox'></div>");
tipType == 'load' && this.loadRenderUI();
tipType == 'success' && this.successRenderUI();
tipType == 'error' && this.errorRenderUI();
tipType == 'tip' && this.tipRenderUI();
TipBox.prototype.boundingBox.appendTo(this.config.windowDom.document.body);
//是否显示遮罩
if(this.config.hasMask){
this.config.hasMaskWhite ? this._mask = $("<div class='mask_white'></div>") : this._mask = $("<div class='mask'></div>");
this._mask.appendTo(this.config.windowDom.document.body);
}
// 是否显示按钮
if(this.config.hasBtn){
this.config.height = 206;
$('#animationTipBox').css("margin-top","103px");
switch(this.config.type){
case 'success':$(".success").after("<button class='okoButton'>ok</button>");
break;
case 'error':$(".lose").after("<button class='okoButton redOkoButton'>ok</button>");
break;
case 'tip':$(".tip").after("<button class='okoButton'>ok</button>");
break;
default: break;
}
$('button.okoButton').on('click',function(){_this.close(); window.location.href= '';});
}
//定时消失
_this = this;
!this.config.setTime && typeof this.config.callBack === "function" && (this.config.setTime = 1);
this.config.setTime && setTimeout( function(){ _this.close(); }, _this.config.setTime );
};
TipBox.prototype.bindUI = function(){
_this = this;
//点击空白立即取消
this.config.clickDomCancel && this._mask && this._mask.click(function(){_this.close(); });
};
TipBox.prototype.syncUI = function(){
TipBox.prototype.boundingBox.css({
width : this.config.width+'px',
height : this.config.height+'px',
marginLeft : "-"+(this.config.width/2)+'px',
marginTop : "-"+(this.config.height/2)+'px'
});
};
//提示效果UI
TipBox.prototype.tipRenderUI = function(){
var tip = "<div class='tip'>";
tip +=" <div class='icon'>i</div>";
tip +=" <div class='dec_txt'>"+this.config.str+"</div>";
tip += "</div>";
TipBox.prototype.boundingBox.append(tip);
};
//成功效果UI
TipBox.prototype.successRenderUI = function(){
var suc = "<div class='success'>";
suc +=" <div class='icon'>";
suc += "<div class='line_short'></div>";
suc += "<div class='line_long'></div> ";
suc += "</div>";
suc +=" <div class='dec_txt'>"+this.config.str+"</div>";
suc += "</div>";
TipBox.prototype.boundingBox.append(suc);
};
//错误效果UI
TipBox.prototype.errorRenderUI = function(){
var err = "<div class='lose'>";
err += " <div class='icon'>";
err += " <div class='icon_box'>";
err += " <div class='line_left'></div>";
err += " <div class='line_right'></div>";
err += " </div>";
err += " </div>";
err += "<div class='dec_txt'>"+this.config.str+"</div>";
err += "</div>";
TipBox.prototype.boundingBox.append(err);
};
//加载动画load UI
TipBox.prototype.loadRenderUI = function(){
var load = "<div class='load'>";
load += "<div class='icon_box'>";
for(var i = 1; i < 4; i++ ){
load += "<div class='cirBox"+i+"'>";
load += "<div class='cir1'></div>";
load += "<div class='cir2'></div>";
load += "<div class='cir3'></div>";
load += "<div class='cir4'></div>";
load += "</div>";
}
load += "</div>";
load += "</div>";
load += "<div class='dec_txt'>"+this.config.str+"</div>";
TipBox.prototype.boundingBox.append(load);
};
//关闭
TipBox.prototype.close = function(){
TipBox.prototype.destroy();
this.destroy();
this.config.setTime && typeof this.config.callBack === "function" && this.config.callBack();
};
//销毁
TipBox.prototype.destroy = function(){
this._mask && this._mask.remove();
TipBox.prototype.boundingBox && TipBox.prototype.boundingBox.remove();
TipBox.prototype.boundingBox = null;
};
\ No newline at end of file
... ...
/* Zepto v1.1.3 - zepto event ajax form ie - zeptojs.com/license */
var Zepto=function(){function L(t){return null==t?String(t):j[T.call(t)]||"object"}function Z(t){return"function"==L(t)}function $(t){return null!=t&&t==t.window}function _(t){return null!=t&&t.nodeType==t.DOCUMENT_NODE}function D(t){return"object"==L(t)}function R(t){return D(t)&&!$(t)&&Object.getPrototypeOf(t)==Object.prototype}function M(t){return"number"==typeof t.length}function k(t){return s.call(t,function(t){return null!=t})}function z(t){return t.length>0?n.fn.concat.apply([],t):t}function F(t){return t.replace(/::/g,"/").replace(/([A-Z]+)([A-Z][a-z])/g,"$1_$2").replace(/([a-z\d])([A-Z])/g,"$1_$2").replace(/_/g,"-").toLowerCase()}function q(t){return t in f?f[t]:f[t]=new RegExp("(^|\\s)"+t+"(\\s|$)")}function H(t,e){return"number"!=typeof e||c[F(t)]?e:e+"px"}function I(t){var e,n;return u[t]||(e=a.createElement(t),a.body.appendChild(e),n=getComputedStyle(e,"").getPropertyValue("display"),e.parentNode.removeChild(e),"none"==n&&(n="block"),u[t]=n),u[t]}function V(t){return"children"in t?o.call(t.children):n.map(t.childNodes,function(t){return 1==t.nodeType?t:void 0})}function U(n,i,r){for(e in i)r&&(R(i[e])||A(i[e]))?(R(i[e])&&!R(n[e])&&(n[e]={}),A(i[e])&&!A(n[e])&&(n[e]=[]),U(n[e],i[e],r)):i[e]!==t&&(n[e]=i[e])}function B(t,e){return null==e?n(t):n(t).filter(e)}function J(t,e,n,i){return Z(e)?e.call(t,n,i):e}function X(t,e,n){null==n?t.removeAttribute(e):t.setAttribute(e,n)}function W(e,n){var i=e.className,r=i&&i.baseVal!==t;return n===t?r?i.baseVal:i:void(r?i.baseVal=n:e.className=n)}function Y(t){var e;try{return t?"true"==t||("false"==t?!1:"null"==t?null:/^0/.test(t)||isNaN(e=Number(t))?/^[\[\{]/.test(t)?n.parseJSON(t):t:e):t}catch(i){return t}}function G(t,e){e(t);for(var n in t.childNodes)G(t.childNodes[n],e)}var t,e,n,i,C,N,r=[],o=r.slice,s=r.filter,a=window.document,u={},f={},c={"column-count":1,columns:1,"font-weight":1,"line-height":1,opacity:1,"z-index":1,zoom:1},l=/^\s*<(\w+|!)[^>]*>/,h=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,p=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,d=/^(?:body|html)$/i,m=/([A-Z])/g,g=["val","css","html","text","data","width","height","offset"],v=["after","prepend","before","append"],y=a.createElement("table"),x=a.createElement("tr"),b={tr:a.createElement("tbody"),tbody:y,thead:y,tfoot:y,td:x,th:x,"*":a.createElement("div")},w=/complete|loaded|interactive/,E=/^[\w-]*$/,j={},T=j.toString,S={},O=a.createElement("div"),P={tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},A=Array.isArray||function(t){return t instanceof Array};return S.matches=function(t,e){if(!e||!t||1!==t.nodeType)return!1;var n=t.webkitMatchesSelector||t.mozMatchesSelector||t.oMatchesSelector||t.matchesSelector;if(n)return n.call(t,e);var i,r=t.parentNode,o=!r;return o&&(r=O).appendChild(t),i=~S.qsa(r,e).indexOf(t),o&&O.removeChild(t),i},C=function(t){return t.replace(/-+(.)?/g,function(t,e){return e?e.toUpperCase():""})},N=function(t){return s.call(t,function(e,n){return t.indexOf(e)==n})},S.fragment=function(e,i,r){var s,u,f;return h.test(e)&&(s=n(a.createElement(RegExp.$1))),s||(e.replace&&(e=e.replace(p,"<$1></$2>")),i===t&&(i=l.test(e)&&RegExp.$1),i in b||(i="*"),f=b[i],f.innerHTML=""+e,s=n.each(o.call(f.childNodes),function(){f.removeChild(this)})),R(r)&&(u=n(s),n.each(r,function(t,e){g.indexOf(t)>-1?u[t](e):u.attr(t,e)})),s},S.Z=function(t,e){return t=t||[],t.__proto__=n.fn,t.selector=e||"",t},S.isZ=function(t){return t instanceof S.Z},S.init=function(e,i){var r;if(!e)return S.Z();if("string"==typeof e)if(e=e.trim(),"<"==e[0]&&l.test(e))r=S.fragment(e,RegExp.$1,i),e=null;else{if(i!==t)return n(i).find(e);r=S.qsa(a,e)}else{if(Z(e))return n(a).ready(e);if(S.isZ(e))return e;if(A(e))r=k(e);else if(D(e))r=[e],e=null;else if(l.test(e))r=S.fragment(e.trim(),RegExp.$1,i),e=null;else{if(i!==t)return n(i).find(e);r=S.qsa(a,e)}}return S.Z(r,e)},n=function(t,e){return S.init(t,e)},n.extend=function(t){var e,n=o.call(arguments,1);return"boolean"==typeof t&&(e=t,t=n.shift()),n.forEach(function(n){U(t,n,e)}),t},S.qsa=function(t,e){var n,i="#"==e[0],r=!i&&"."==e[0],s=i||r?e.slice(1):e,a=E.test(s);return _(t)&&a&&i?(n=t.getElementById(s))?[n]:[]:1!==t.nodeType&&9!==t.nodeType?[]:o.call(a&&!i?r?t.getElementsByClassName(s):t.getElementsByTagName(e):t.querySelectorAll(e))},n.contains=function(t,e){return t!==e&&t.contains(e)},n.type=L,n.isFunction=Z,n.isWindow=$,n.isArray=A,n.isPlainObject=R,n.isEmptyObject=function(t){var e;for(e in t)return!1;return!0},n.inArray=function(t,e,n){return r.indexOf.call(e,t,n)},n.camelCase=C,n.trim=function(t){return null==t?"":String.prototype.trim.call(t)},n.uuid=0,n.support={},n.expr={},n.map=function(t,e){var n,r,o,i=[];if(M(t))for(r=0;r<t.length;r++)n=e(t[r],r),null!=n&&i.push(n);else for(o in t)n=e(t[o],o),null!=n&&i.push(n);return z(i)},n.each=function(t,e){var n,i;if(M(t)){for(n=0;n<t.length;n++)if(e.call(t[n],n,t[n])===!1)return t}else for(i in t)if(e.call(t[i],i,t[i])===!1)return t;return t},n.grep=function(t,e){return s.call(t,e)},window.JSON&&(n.parseJSON=JSON.parse),n.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(t,e){j["[object "+e+"]"]=e.toLowerCase()}),n.fn={forEach:r.forEach,reduce:r.reduce,push:r.push,sort:r.sort,indexOf:r.indexOf,concat:r.concat,map:function(t){return n(n.map(this,function(e,n){return t.call(e,n,e)}))},slice:function(){return n(o.apply(this,arguments))},ready:function(t){return w.test(a.readyState)&&a.body?t(n):a.addEventListener("DOMContentLoaded",function(){t(n)},!1),this},get:function(e){return e===t?o.call(this):this[e>=0?e:e+this.length]},toArray:function(){return this.get()},size:function(){return this.length},remove:function(){return this.each(function(){null!=this.parentNode&&this.parentNode.removeChild(this)})},each:function(t){return r.every.call(this,function(e,n){return t.call(e,n,e)!==!1}),this},filter:function(t){return Z(t)?this.not(this.not(t)):n(s.call(this,function(e){return S.matches(e,t)}))},add:function(t,e){return n(N(this.concat(n(t,e))))},is:function(t){return this.length>0&&S.matches(this[0],t)},not:function(e){var i=[];if(Z(e)&&e.call!==t)this.each(function(t){e.call(this,t)||i.push(this)});else{var r="string"==typeof e?this.filter(e):M(e)&&Z(e.item)?o.call(e):n(e);this.forEach(function(t){r.indexOf(t)<0&&i.push(t)})}return n(i)},has:function(t){return this.filter(function(){return D(t)?n.contains(this,t):n(this).find(t).size()})},eq:function(t){return-1===t?this.slice(t):this.slice(t,+t+1)},first:function(){var t=this[0];return t&&!D(t)?t:n(t)},last:function(){var t=this[this.length-1];return t&&!D(t)?t:n(t)},find:function(t){var e,i=this;return e="object"==typeof t?n(t).filter(function(){var t=this;return r.some.call(i,function(e){return n.contains(e,t)})}):1==this.length?n(S.qsa(this[0],t)):this.map(function(){return S.qsa(this,t)})},closest:function(t,e){var i=this[0],r=!1;for("object"==typeof t&&(r=n(t));i&&!(r?r.indexOf(i)>=0:S.matches(i,t));)i=i!==e&&!_(i)&&i.parentNode;return n(i)},parents:function(t){for(var e=[],i=this;i.length>0;)i=n.map(i,function(t){return(t=t.parentNode)&&!_(t)&&e.indexOf(t)<0?(e.push(t),t):void 0});return B(e,t)},parent:function(t){return B(N(this.pluck("parentNode")),t)},children:function(t){return B(this.map(function(){return V(this)}),t)},contents:function(){return this.map(function(){return o.call(this.childNodes)})},siblings:function(t){return B(this.map(function(t,e){return s.call(V(e.parentNode),function(t){return t!==e})}),t)},empty:function(){return this.each(function(){this.innerHTML=""})},pluck:function(t){return n.map(this,function(e){return e[t]})},show:function(){return this.each(function(){"none"==this.style.display&&(this.style.display=""),"none"==getComputedStyle(this,"").getPropertyValue("display")&&(this.style.display=I(this.nodeName))})},replaceWith:function(t){return this.before(t).remove()},wrap:function(t){var e=Z(t);if(this[0]&&!e)var i=n(t).get(0),r=i.parentNode||this.length>1;return this.each(function(o){n(this).wrapAll(e?t.call(this,o):r?i.cloneNode(!0):i)})},wrapAll:function(t){if(this[0]){n(this[0]).before(t=n(t));for(var e;(e=t.children()).length;)t=e.first();n(t).append(this)}return this},wrapInner:function(t){var e=Z(t);return this.each(function(i){var r=n(this),o=r.contents(),s=e?t.call(this,i):t;o.length?o.wrapAll(s):r.append(s)})},unwrap:function(){return this.parent().each(function(){n(this).replaceWith(n(this).children())}),this},clone:function(){return this.map(function(){return this.cloneNode(!0)})},hide:function(){return this.css("display","none")},toggle:function(e){return this.each(function(){var i=n(this);(e===t?"none"==i.css("display"):e)?i.show():i.hide()})},prev:function(t){return n(this.pluck("previousElementSibling")).filter(t||"*")},next:function(t){return n(this.pluck("nextElementSibling")).filter(t||"*")},html:function(t){return 0===arguments.length?this.length>0?this[0].innerHTML:null:this.each(function(e){var i=this.innerHTML;n(this).empty().append(J(this,t,e,i))})},text:function(e){return 0===arguments.length?this.length>0?this[0].textContent:null:this.each(function(){this.textContent=e===t?"":""+e})},attr:function(n,i){var r;return"string"==typeof n&&i===t?0==this.length||1!==this[0].nodeType?t:"value"==n&&"INPUT"==this[0].nodeName?this.val():!(r=this[0].getAttribute(n))&&n in this[0]?this[0][n]:r:this.each(function(t){if(1===this.nodeType)if(D(n))for(e in n)X(this,e,n[e]);else X(this,n,J(this,i,t,this.getAttribute(n)))})},removeAttr:function(t){return this.each(function(){1===this.nodeType&&X(this,t)})},prop:function(e,n){return e=P[e]||e,n===t?this[0]&&this[0][e]:this.each(function(t){this[e]=J(this,n,t,this[e])})},data:function(e,n){var i=this.attr("data-"+e.replace(m,"-$1").toLowerCase(),n);return null!==i?Y(i):t},val:function(t){return 0===arguments.length?this[0]&&(this[0].multiple?n(this[0]).find("option").filter(function(){return this.selected}).pluck("value"):this[0].value):this.each(function(e){this.value=J(this,t,e,this.value)})},offset:function(t){if(t)return this.each(function(e){var i=n(this),r=J(this,t,e,i.offset()),o=i.offsetParent().offset(),s={top:r.top-o.top,left:r.left-o.left};"static"==i.css("position")&&(s.position="relative"),i.css(s)});if(0==this.length)return null;var e=this[0].getBoundingClientRect();return{left:e.left+window.pageXOffset,top:e.top+window.pageYOffset,width:Math.round(e.width),height:Math.round(e.height)}},css:function(t,i){if(arguments.length<2){var r=this[0],o=getComputedStyle(r,"");if(!r)return;if("string"==typeof t)return r.style[C(t)]||o.getPropertyValue(t);if(A(t)){var s={};return n.each(A(t)?t:[t],function(t,e){s[e]=r.style[C(e)]||o.getPropertyValue(e)}),s}}var a="";if("string"==L(t))i||0===i?a=F(t)+":"+H(t,i):this.each(function(){this.style.removeProperty(F(t))});else for(e in t)t[e]||0===t[e]?a+=F(e)+":"+H(e,t[e])+";":this.each(function(){this.style.removeProperty(F(e))});return this.each(function(){this.style.cssText+=";"+a})},index:function(t){return t?this.indexOf(n(t)[0]):this.parent().children().indexOf(this[0])},hasClass:function(t){return t?r.some.call(this,function(t){return this.test(W(t))},q(t)):!1},addClass:function(t){return t?this.each(function(e){i=[];var r=W(this),o=J(this,t,e,r);o.split(/\s+/g).forEach(function(t){n(this).hasClass(t)||i.push(t)},this),i.length&&W(this,r+(r?" ":"")+i.join(" "))}):this},removeClass:function(e){return this.each(function(n){return e===t?W(this,""):(i=W(this),J(this,e,n,i).split(/\s+/g).forEach(function(t){i=i.replace(q(t)," ")}),void W(this,i.trim()))})},toggleClass:function(e,i){return e?this.each(function(r){var o=n(this),s=J(this,e,r,W(this));s.split(/\s+/g).forEach(function(e){(i===t?!o.hasClass(e):i)?o.addClass(e):o.removeClass(e)})}):this},scrollTop:function(e){if(this.length){var n="scrollTop"in this[0];return e===t?n?this[0].scrollTop:this[0].pageYOffset:this.each(n?function(){this.scrollTop=e}:function(){this.scrollTo(this.scrollX,e)})}},scrollLeft:function(e){if(this.length){var n="scrollLeft"in this[0];return e===t?n?this[0].scrollLeft:this[0].pageXOffset:this.each(n?function(){this.scrollLeft=e}:function(){this.scrollTo(e,this.scrollY)})}},position:function(){if(this.length){var t=this[0],e=this.offsetParent(),i=this.offset(),r=d.test(e[0].nodeName)?{top:0,left:0}:e.offset();return i.top-=parseFloat(n(t).css("margin-top"))||0,i.left-=parseFloat(n(t).css("margin-left"))||0,r.top+=parseFloat(n(e[0]).css("border-top-width"))||0,r.left+=parseFloat(n(e[0]).css("border-left-width"))||0,{top:i.top-r.top,left:i.left-r.left}}},offsetParent:function(){return this.map(function(){for(var t=this.offsetParent||a.body;t&&!d.test(t.nodeName)&&"static"==n(t).css("position");)t=t.offsetParent;return t})}},n.fn.detach=n.fn.remove,["width","height"].forEach(function(e){var i=e.replace(/./,function(t){return t[0].toUpperCase()});n.fn[e]=function(r){var o,s=this[0];return r===t?$(s)?s["inner"+i]:_(s)?s.documentElement["scroll"+i]:(o=this.offset())&&o[e]:this.each(function(t){s=n(this),s.css(e,J(this,r,t,s[e]()))})}}),v.forEach(function(t,e){var i=e%2;n.fn[t]=function(){var t,o,r=n.map(arguments,function(e){return t=L(e),"object"==t||"array"==t||null==e?e:S.fragment(e)}),s=this.length>1;return r.length<1?this:this.each(function(t,a){o=i?a:a.parentNode,a=0==e?a.nextSibling:1==e?a.firstChild:2==e?a:null,r.forEach(function(t){if(s)t=t.cloneNode(!0);else if(!o)return n(t).remove();G(o.insertBefore(t,a),function(t){null==t.nodeName||"SCRIPT"!==t.nodeName.toUpperCase()||t.type&&"text/javascript"!==t.type||t.src||window.eval.call(window,t.innerHTML)})})})},n.fn[i?t+"To":"insert"+(e?"Before":"After")]=function(e){return n(e)[t](this),this}}),S.Z.prototype=n.fn,S.uniq=N,S.deserializeValue=Y,n.zepto=S,n}();window.Zepto=Zepto,void 0===window.$&&(window.$=Zepto),function(t){function l(t){return t._zid||(t._zid=e++)}function h(t,e,n,i){if(e=p(e),e.ns)var r=d(e.ns);return(s[l(t)]||[]).filter(function(t){return!(!t||e.e&&t.e!=e.e||e.ns&&!r.test(t.ns)||n&&l(t.fn)!==l(n)||i&&t.sel!=i)})}function p(t){var e=(""+t).split(".");return{e:e[0],ns:e.slice(1).sort().join(" ")}}function d(t){return new RegExp("(?:^| )"+t.replace(" "," .* ?")+"(?: |$)")}function m(t,e){return t.del&&!u&&t.e in f||!!e}function g(t){return c[t]||u&&f[t]||t}function v(e,i,r,o,a,u,f){var h=l(e),d=s[h]||(s[h]=[]);i.split(/\s/).forEach(function(i){if("ready"==i)return t(document).ready(r);var s=p(i);s.fn=r,s.sel=a,s.e in c&&(r=function(e){var n=e.relatedTarget;return!n||n!==this&&!t.contains(this,n)?s.fn.apply(this,arguments):void 0}),s.del=u;var l=u||r;s.proxy=function(t){if(t=j(t),!t.isImmediatePropagationStopped()){t.data=o;var i=l.apply(e,t._args==n?[t]:[t].concat(t._args));return i===!1&&(t.preventDefault(),t.stopPropagation()),i}},s.i=d.length,d.push(s),"addEventListener"in e&&e.addEventListener(g(s.e),s.proxy,m(s,f))})}function y(t,e,n,i,r){var o=l(t);(e||"").split(/\s/).forEach(function(e){h(t,e,n,i).forEach(function(e){delete s[o][e.i],"removeEventListener"in t&&t.removeEventListener(g(e.e),e.proxy,m(e,r))})})}function j(e,i){return(i||!e.isDefaultPrevented)&&(i||(i=e),t.each(E,function(t,n){var r=i[t];e[t]=function(){return this[n]=x,r&&r.apply(i,arguments)},e[n]=b}),(i.defaultPrevented!==n?i.defaultPrevented:"returnValue"in i?i.returnValue===!1:i.getPreventDefault&&i.getPreventDefault())&&(e.isDefaultPrevented=x)),e}function T(t){var e,i={originalEvent:t};for(e in t)w.test(e)||t[e]===n||(i[e]=t[e]);return j(i,t)}var n,e=1,i=Array.prototype.slice,r=t.isFunction,o=function(t){return"string"==typeof t},s={},a={},u="onfocusin"in window,f={focus:"focusin",blur:"focusout"},c={mouseenter:"mouseover",mouseleave:"mouseout"};a.click=a.mousedown=a.mouseup=a.mousemove="MouseEvents",t.event={add:v,remove:y},t.proxy=function(e,n){if(r(e)){var i=function(){return e.apply(n,arguments)};return i._zid=l(e),i}if(o(n))return t.proxy(e[n],e);throw new TypeError("expected function")},t.fn.bind=function(t,e,n){return this.on(t,e,n)},t.fn.unbind=function(t,e){return this.off(t,e)},t.fn.one=function(t,e,n,i){return this.on(t,e,n,i,1)};var x=function(){return!0},b=function(){return!1},w=/^([A-Z]|returnValue$|layer[XY]$)/,E={preventDefault:"isDefaultPrevented",stopImmediatePropagation:"isImmediatePropagationStopped",stopPropagation:"isPropagationStopped"};t.fn.delegate=function(t,e,n){return this.on(e,t,n)},t.fn.undelegate=function(t,e,n){return this.off(e,t,n)},t.fn.live=function(e,n){return t(document.body).delegate(this.selector,e,n),this},t.fn.die=function(e,n){return t(document.body).undelegate(this.selector,e,n),this},t.fn.on=function(e,s,a,u,f){var c,l,h=this;return e&&!o(e)?(t.each(e,function(t,e){h.on(t,s,a,e,f)}),h):(o(s)||r(u)||u===!1||(u=a,a=s,s=n),(r(a)||a===!1)&&(u=a,a=n),u===!1&&(u=b),h.each(function(n,r){f&&(c=function(t){return y(r,t.type,u),u.apply(this,arguments)}),s&&(l=function(e){var n,o=t(e.target).closest(s,r).get(0);return o&&o!==r?(n=t.extend(T(e),{currentTarget:o,liveFired:r}),(c||u).apply(o,[n].concat(i.call(arguments,1)))):void 0}),v(r,e,u,a,s,l||c)}))},t.fn.off=function(e,i,s){var a=this;return e&&!o(e)?(t.each(e,function(t,e){a.off(t,i,e)}),a):(o(i)||r(s)||s===!1||(s=i,i=n),s===!1&&(s=b),a.each(function(){y(this,e,s,i)}))},t.fn.trigger=function(e,n){return e=o(e)||t.isPlainObject(e)?t.Event(e):j(e),e._args=n,this.each(function(){"dispatchEvent"in this?this.dispatchEvent(e):t(this).triggerHandler(e,n)})},t.fn.triggerHandler=function(e,n){var i,r;return this.each(function(s,a){i=T(o(e)?t.Event(e):e),i._args=n,i.target=a,t.each(h(a,e.type||e),function(t,e){return r=e.proxy(i),i.isImmediatePropagationStopped()?!1:void 0})}),r},"focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select keydown keypress keyup error".split(" ").forEach(function(e){t.fn[e]=function(t){return t?this.bind(e,t):this.trigger(e)}}),["focus","blur"].forEach(function(e){t.fn[e]=function(t){return t?this.bind(e,t):this.each(function(){try{this[e]()}catch(t){}}),this}}),t.Event=function(t,e){o(t)||(e=t,t=e.type);var n=document.createEvent(a[t]||"Events"),i=!0;if(e)for(var r in e)"bubbles"==r?i=!!e[r]:n[r]=e[r];return n.initEvent(t,i,!0),j(n)}}(Zepto),function(t){function l(e,n,i){var r=t.Event(n);return t(e).trigger(r,i),!r.isDefaultPrevented()}function h(t,e,i,r){return t.global?l(e||n,i,r):void 0}function p(e){e.global&&0===t.active++&&h(e,null,"ajaxStart")}function d(e){e.global&&!--t.active&&h(e,null,"ajaxStop")}function m(t,e){var n=e.context;return e.beforeSend.call(n,t,e)===!1||h(e,n,"ajaxBeforeSend",[t,e])===!1?!1:void h(e,n,"ajaxSend",[t,e])}function g(t,e,n,i){var r=n.context,o="success";n.success.call(r,t,o,e),i&&i.resolveWith(r,[t,o,e]),h(n,r,"ajaxSuccess",[e,n,t]),y(o,e,n)}function v(t,e,n,i,r){var o=i.context;i.error.call(o,n,e,t),r&&r.rejectWith(o,[n,e,t]),h(i,o,"ajaxError",[n,i,t||e]),y(e,n,i)}function y(t,e,n){var i=n.context;n.complete.call(i,e,t),h(n,i,"ajaxComplete",[e,n]),d(n)}function x(){}function b(t){return t&&(t=t.split(";",2)[0]),t&&(t==f?"html":t==u?"json":s.test(t)?"script":a.test(t)&&"xml")||"text"}function w(t,e){return""==e?t:(t+"&"+e).replace(/[&?]{1,2}/,"?")}function E(e){e.processData&&e.data&&"string"!=t.type(e.data)&&(e.data=t.param(e.data,e.traditional)),!e.data||e.type&&"GET"!=e.type.toUpperCase()||(e.url=w(e.url,e.data),e.data=void 0)}function j(e,n,i,r){return t.isFunction(n)&&(r=i,i=n,n=void 0),t.isFunction(i)||(r=i,i=void 0),{url:e,data:n,success:i,dataType:r}}function S(e,n,i,r){var o,s=t.isArray(n),a=t.isPlainObject(n);t.each(n,function(n,u){o=t.type(u),r&&(n=i?r:r+"["+(a||"object"==o||"array"==o?n:"")+"]"),!r&&s?e.add(u.name,u.value):"array"==o||!i&&"object"==o?S(e,u,i,n):e.add(n,u)})}var i,r,e=0,n=window.document,o=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,s=/^(?:text|application)\/javascript/i,a=/^(?:text|application)\/xml/i,u="application/json",f="text/html",c=/^\s*$/;t.active=0,t.ajaxJSONP=function(i,r){if(!("type"in i))return t.ajax(i);var f,h,o=i.jsonpCallback,s=(t.isFunction(o)?o():o)||"jsonp"+ ++e,a=n.createElement("script"),u=window[s],c=function(e){t(a).triggerHandler("error",e||"abort")},l={abort:c};return r&&r.promise(l),t(a).on("load error",function(e,n){clearTimeout(h),t(a).off().remove(),"error"!=e.type&&f?g(f[0],l,i,r):v(null,n||"error",l,i,r),window[s]=u,f&&t.isFunction(u)&&u(f[0]),u=f=void 0}),m(l,i)===!1?(c("abort"),l):(window[s]=function(){f=arguments},a.src=i.url.replace(/\?(.+)=\?/,"?$1="+s),n.head.appendChild(a),i.timeout>0&&(h=setTimeout(function(){c("timeout")},i.timeout)),l)},t.ajaxSettings={type:"GET",beforeSend:x,success:x,error:x,complete:x,context:null,global:!0,xhr:function(){return new window.XMLHttpRequest},accepts:{script:"text/javascript, application/javascript, application/x-javascript",json:u,xml:"application/xml, text/xml",html:f,text:"text/plain"},crossDomain:!1,timeout:0,processData:!0,cache:!0},t.ajax=function(e){var n=t.extend({},e||{}),o=t.Deferred&&t.Deferred();for(i in t.ajaxSettings)void 0===n[i]&&(n[i]=t.ajaxSettings[i]);p(n),n.crossDomain||(n.crossDomain=/^([\w-]+:)?\/\/([^\/]+)/.test(n.url)&&RegExp.$2!=window.location.host),n.url||(n.url=window.location.toString()),E(n),n.cache===!1&&(n.url=w(n.url,"_="+Date.now()));var s=n.dataType,a=/\?.+=\?/.test(n.url);if("jsonp"==s||a)return a||(n.url=w(n.url,n.jsonp?n.jsonp+"=?":n.jsonp===!1?"":"callback=?")),t.ajaxJSONP(n,o);var j,u=n.accepts[s],f={},l=function(t,e){f[t.toLowerCase()]=[t,e]},h=/^([\w-]+:)\/\//.test(n.url)?RegExp.$1:window.location.protocol,d=n.xhr(),y=d.setRequestHeader;if(o&&o.promise(d),n.crossDomain||l("X-Requested-With","XMLHttpRequest"),l("Accept",u||"*/*"),(u=n.mimeType||u)&&(u.indexOf(",")>-1&&(u=u.split(",",2)[0]),d.overrideMimeType&&d.overrideMimeType(u)),(n.contentType||n.contentType!==!1&&n.data&&"GET"!=n.type.toUpperCase())&&l("Content-Type",n.contentType||"application/x-www-form-urlencoded"),n.headers)for(r in n.headers)l(r,n.headers[r]);if(d.setRequestHeader=l,d.onreadystatechange=function(){if(4==d.readyState){d.onreadystatechange=x,clearTimeout(j);var e,i=!1;if(d.status>=200&&d.status<300||304==d.status||0==d.status&&"file:"==h){s=s||b(n.mimeType||d.getResponseHeader("content-type")),e=d.responseText;try{"script"==s?(1,eval)(e):"xml"==s?e=d.responseXML:"json"==s&&(e=c.test(e)?null:t.parseJSON(e))}catch(r){i=r}i?v(i,"parsererror",d,n,o):g(e,d,n,o)}else v(d.statusText||null,d.status?"error":"abort",d,n,o)}},m(d,n)===!1)return d.abort(),v(null,"abort",d,n,o),d;if(n.xhrFields)for(r in n.xhrFields)d[r]=n.xhrFields[r];var T="async"in n?n.async:!0;d.open(n.type,n.url,T,n.username,n.password);for(r in f)y.apply(d,f[r]);return n.timeout>0&&(j=setTimeout(function(){d.onreadystatechange=x,d.abort(),v(null,"timeout",d,n,o)},n.timeout)),d.send(n.data?n.data:null),d},t.get=function(){return t.ajax(j.apply(null,arguments))},t.post=function(){var e=j.apply(null,arguments);return e.type="POST",t.ajax(e)},t.getJSON=function(){var e=j.apply(null,arguments);return e.dataType="json",t.ajax(e)},t.fn.load=function(e,n,i){if(!this.length)return this;var a,r=this,s=e.split(/\s/),u=j(e,n,i),f=u.success;return s.length>1&&(u.url=s[0],a=s[1]),u.success=function(e){r.html(a?t("<div>").html(e.replace(o,"")).find(a):e),f&&f.apply(r,arguments)},t.ajax(u),this};var T=encodeURIComponent;t.param=function(t,e){var n=[];return n.add=function(t,e){this.push(T(t)+"="+T(e))},S(n,t,e),n.join("&").replace(/%20/g,"+")}}(Zepto),function(t){t.fn.serializeArray=function(){var n,e=[];return t([].slice.call(this.get(0).elements)).each(function(){n=t(this);var i=n.attr("type");"fieldset"!=this.nodeName.toLowerCase()&&!this.disabled&&"submit"!=i&&"reset"!=i&&"button"!=i&&("radio"!=i&&"checkbox"!=i||this.checked)&&e.push({name:n.attr("name"),value:n.val()})}),e},t.fn.serialize=function(){var t=[];return this.serializeArray().forEach(function(e){t.push(encodeURIComponent(e.name)+"="+encodeURIComponent(e.value))}),t.join("&")},t.fn.submit=function(e){if(e)this.bind("submit",e);else if(this.length){var n=t.Event("submit");this.eq(0).trigger(n),n.isDefaultPrevented()||this.get(0).submit()}return this}}(Zepto),function(t){"__proto__"in{}||t.extend(t.zepto,{Z:function(e,n){return e=e||[],t.extend(e,t.fn),e.selector=n||"",e.__Z=!0,e},isZ:function(e){return"array"===t.type(e)&&"__Z"in e}});try{getComputedStyle(void 0)}catch(e){var n=getComputedStyle;window.getComputedStyle=function(t){try{return n(t)}catch(e){return null}}}}(Zepto);
/* |xGv00|76e366be624ab0accdb9172bccdb3102 */
\ No newline at end of file
... ...
<include file="public@header"/>
<style type="text/css">
.pic-list li {
margin-bottom: 5px;
}
</style>
</head>
<body>
<div class="wrap js-check-wrap">
<ul class="nav nav-tabs">
<li><a href="{:url('Brand/index')}">品牌中介列表</a></li>
<li class="active"><a href="{:url('Brand/add')}">添加品牌中介</a></li>
</ul>
<form action="{:url('Brand/add')}" method="post" class="form-horizontal js-ajax-form margin-top-20">
<div class="row">
<div class="col-md-9">
<table class="table table-bordered">
<input class="form-control" type="hidden" name="id"
value="{$list['id']}"/>
<tr>
<th width="15%">品牌企业名</th>
<td><input class="form-control" type="text" name="name"
value="{$list['name']}" placeholder="请输入品牌企业名"/>
</td>
</tr>
<tr>
<th width="10%">排序</th>
<td><input class="form-control" type="text" name="score"
value="{$list['score']}" placeholder="请输入排序,数字越大越靠前"/>
</td>
</tr>
<!--<tr>-->
<!--<th>排序</th>-->
<!--<td>-->
<!--<input class="form-control" type="text" name="score"-->
<!--value="{$list['score']}" placeholder="请输入排序,数字越大越靠前"/>-->
<!--</td>-->
<!--</tr>-->
</table>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<button type="submit" class="btn btn-primary js-ajax-submit">{:lang('ADD')}</button>
<a class="btn btn-default" href="{:url('Brand/index')}">{:lang('BACK')}</a>
</div>
</div>
</div>
</div>
</form>
</div>
<script type="text/javascript" src="__STATIC__/js/admin.js"></script>
<script type="text/javascript">
//编辑器路径定义
var editorURL = GV.WEB_ROOT;
</script>
<script type="text/javascript" src="__STATIC__/js/ueditor/ueditor.config.js"></script>
<script type="text/javascript" src="__STATIC__/js/ueditor/ueditor.all.min.js"></script>
<script type="text/javascript">
$(function () {
editorcontent = new baidu.editor.ui.Editor();
editorcontent.render('content');
try {
editorcontent.sync();
} catch (err) {
}
$('.btn-cancel-thumbnail').click(function () {
$('#thumbnail-preview').attr('src', '__TMPL__/public/assets/images/default-thumbnail.png');
$('#thumbnail').val('');
});
});
// function doSelectCategory() {
// var selectedCategoriesId = $('#js-categories-id-input').val();
// openIframeLayer("{:url('AdminCategory/select')}?ids=" + selectedCategoriesId, '请选择分类', {
// area: ['700px', '400px'],
// btn: ['确定', '取消'],
// yes: function (index, layero) {
// //do something
//
// var iframeWin = window[layero.find('iframe')[0]['name']];
// var selectedCategories = iframeWin.confirm();
// if (selectedCategories.selectedCategoriesId.length == 0) {
// layer.msg('请选择分类');
// return;
// }
// $('#js-categories-id-input').val(selectedCategories.selectedCategoriesId.join(','));
// $('#js-categories-name-input').val(selectedCategories.selectedCategoriesName.join(' '));
// //console.log(layer.getFrameIndex(index));
// layer.close(index); //如果设定了yes回调,需进行手工关闭
// }
// });
// }
</script>
</body>
</html>
... ...
<include file="public@header"/>
</head>
<body>
<div class="wrap js-check-wrap">
<ul class="nav nav-tabs">
<li class="active"><a href="javascript:;">品牌中介列表</a></li>
<li><a href="{:url('Brand/add')}">添加品牌中介</a></li>
</ul>
<form class="well form-inline margin-top-20" method="post" action="{:url('Brand/index')}">
<!--分类:-->
<!--<select class="form-control" name="category" style="width: 140px;">-->
<!--<option value='0'>全部</option>-->
<!--{$category_tree|default=''}-->
<!--</select> &nbsp;&nbsp;-->
时间:
<input type="text" class="form-control js-bootstrap-datetime" name="start_time"
value="{$start_time|default=''}"
style="width: 140px;" autocomplete="off">-
<input type="text" class="form-control js-bootstrap-datetime" name="end_time"
value="{$end_time|default=''}"
style="width: 140px;" autocomplete="off"> &nbsp; &nbsp;
关键字:
<input type="text" class="form-control" name="keyword" style="width: 200px;"
value="{$keyword|default=''}" placeholder="请输入品牌中介名称">
<input type="submit" class="btn btn-primary" value="搜索"/>
<a class="btn btn-danger" href="{:url('Brand/index')}">清空</a>
</form>
<form class="js-ajax-form" action="" method="post">
<div class="table-actions">
<!--<notempty name="category">-->
<!--<button class="btn btn-primary btn-sm js-ajax-submit" type="submit"-->
<!--data-action="{:url('AdminArticle/listOrder')}">{:lang('SORT')}-->
<!--</button>-->
<!--</notempty>-->
<!--<button class="btn btn-primary btn-sm js-ajax-submit" type="submit"-->
<!--data-action="{:url('AdminArticle/publish',array('yes'=>1))}" data-subcheck="true">发布-->
<!--</button>-->
<!--<button class="btn btn-primary btn-sm js-ajax-submit" type="submit"-->
<!--data-action="{:url('AdminArticle/publish',array('no'=>1))}" data-subcheck="true">取消发布-->
<!--</button>-->
<!--<button class="btn btn-primary btn-sm js-ajax-submit" type="submit"-->
<!--data-action="{:url('AdminArticle/top',array('yes'=>1))}" data-subcheck="true">置顶-->
<!--</button>-->
<!--<button class="btn btn-primary btn-sm js-ajax-submit" type="submit"-->
<!--data-action="{:url('AdminArticle/top',array('no'=>1))}" data-subcheck="true">取消置顶-->
<!--</button>-->
<!--<button class="btn btn-primary btn-sm js-ajax-submit" type="submit"-->
<!--data-action="{:url('AdminArticle/recommend',array('yes'=>1))}" data-subcheck="true">推荐-->
<!--</button>-->
<!--<button class="btn btn-primary btn-sm js-ajax-submit" type="submit"-->
<!--data-action="{:url('AdminArticle/recommend',array('no'=>1))}" data-subcheck="true">取消推荐-->
<!--</button>-->
<!--
<notempty name="category">
<button class="btn btn-primary btn-sm js-articles-move" type="button">批量移动</button>
</notempty>
<button class="btn btn-primary btn-sm js-articles-copy" type="button">批量复制</button>
-->
<button class="btn btn-danger btn-sm js-ajax-submit" type="submit"
data-action="{:url('Brand/del')}" data-subcheck="true" data-msg="您确定删除吗?">
{:lang('DELETE')}
</button>
</div>
<table class="table table-hover table-bordered table-list">
<thead>
<tr>
<th width="15">
<label>
<input type="checkbox" class="js-check-all" data-direction="x" data-checklist="js-check-x">
</label>
</th>
<notempty name="category">
<th width="50">{:lang('SORT')}</th>
</notempty>
<th width="50">ID</th>
<th>品牌中介名</th>
<th>排序</th>
<!--<th>排序</th>-->
<th width="130">更新时间</th>
<th width="130">发布时间</th>
<!--<th width="70">状态</th>-->
<th width="90">操作</th>
</tr>
</thead>
<foreach name="list" item="list">
<tr>
<td>
<input type="checkbox" class="js-check" data-yid="js-check-y" data-xid="js-check-x" name="ids[]"
value="{$list.id}" title="ID:{$list.id}">
</td>
<td>{$list.id}</td>
<td>
{$list.name}
</td>
<td>
{$list.score}
</td>
<td>
{:date('Y-m-d H:i',$list['update_time'])}
</td>
<td>
{:date('Y-m-d H:i',$list['create_time'])}
<!--<empty name="vo.published_time">-->
<!--未发布-->
<!--<else/>-->
<!--{:date('Y-m-d H:i',$list['published_time'])}-->
<!--</empty>-->
</td>
<td>
<a href="{:url('Brand/add',array('id'=>$list['id']))}">{:lang('EDIT')}</a>
<a href="{:url('Brand/del',array('id'=>$list['id']))}" class="js-ajax-delete">{:lang('DELETE')}</a>
</td>
</tr>
</foreach>
</table>
<ul class="pagination">{$page|default=''}</ul>
</form>
</div>
<script src="__STATIC__/js/admin.js"></script>
<script>
function reloadPage(win) {
win.location.reload();
}
$(function () {
setCookie("refersh_time", 0);
Wind.use('ajaxForm', 'artDialog', 'iframeTools', function () {
//批量复制
$('.js-articles-copy').click(function (e) {
var ids = [];
$("input[name='ids[]']").each(function () {
if ($(this).is(':checked')) {
ids.push($(this).val());
}
});
if (ids.length == 0) {
art.dialog.through({
id: 'error',
icon: 'error',
content: '您没有勾选信息,无法进行操作!',
cancelVal: '关闭',
cancel: true
});
return false;
}
ids = ids.join(',');
art.dialog.open("__ROOT__/index.php?g=portal&m=AdminArticle&a=copy&ids=" + ids, {
title: "批量复制",
width: "300px"
});
});
//批量移动
$('.js-articles-move').click(function (e) {
var ids = [];
$("input[name='ids[]']").each(function () {
if ($(this).is(':checked')) {
ids.push($(this).val());
}
});
if (ids.length == 0) {
art.dialog.through({
id: 'error',
icon: 'error',
content: '您没有勾选信息,无法进行操作!',
cancelVal: '关闭',
cancel: true
});
return false;
}
ids = ids.join(',');
art.dialog.open("__ROOT__/index.php?g=portal&m=AdminArticle&a=move&old_term_id={$term.term_id|default=0}&ids=" + ids, {
title: "批量移动",
width: "300px"
});
});
});
});
</script>
</body>
</html>
\ No newline at end of file
... ...
... ... @@ -20,11 +20,10 @@
<tr>
<th width="20%">城市</th>
<td>
<select name="city" style="border: 1px solid #dce4ec; width: 15%;">
<volist name="area" id="area">
<option name="area" value="{$area.area_id}" <eq name="list.city" value="$area.area_id">selected</eq>>{$area.area_name}</option>
</volist>
</select>
<volist name="area" id="area">
<input type="checkbox" name="city[]" value="{$area.area_id}" <eq name="list.city" value="$area.area_id">checked</eq>> {$area.area_name}
</volist>
</td>
</tr>
<tr>
... ...
... ... @@ -91,7 +91,9 @@
</td>
<td>{$list.id}</td>
<td>{$list.area_name}</td>
<td>
{$list.area_name}
</td>
<td>
{$list.low_area}
</td>
... ...
<include file="public@header"/>
<style type="text/css">
.pic-list li {
margin-bottom: 5px;
}
</style>
</head>
<body>
<div class="wrap js-check-wrap">
<ul class="nav nav-tabs">
<li><a href="{:url('UserNeed/index')}">保证金说明列表</a></li>
<li class="active"><a href="{:url('UserNeed/add')}">添加保证金说明</a></li>
</ul>
<form action="{:url('UserNeed/add')}" method="post" class="form-horizontal js-ajax-form margin-top-20">
<div class="row">
<div class="col-md-9">
<table class="table table-bordered">
<input class="form-control" type="hidden" name="id"
value="{$list['id']}"/>
<tr>
<th>标题<span class="form-required">*</span></th>
<td>
<input class="form-control" type="text" name="title"
id="title" value="{$list['title']}" placeholder="请输入标题"/>
</td>
</tr>
<tr>
<th width="10%">内容<span class="form-required">*</span></th>
<td>
<script type="text/plain" id="content" name="content">{$list['content']}</script>
</td>
</tr>
<tr>
<th>排序</th>
<td>
<input class="form-control" type="text" name="score"
value="{$list['score']}" placeholder="请输入排序,数字越大越靠前"/>
</td>
</tr>
</table>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<button type="submit" class="btn btn-primary js-ajax-submit">{:lang('ADD')}</button>
<a class="btn btn-default" href="{:url('UserNeed/index')}">{:lang('BACK')}</a>
</div>
</div>
</div>
</div>
</form>
</div>
<script type="text/javascript" src="__STATIC__/js/admin.js"></script>
<script type="text/javascript">
//编辑器路径定义
var editorURL = GV.WEB_ROOT;
</script>
<script type="text/javascript" src="__STATIC__/js/ueditor/ueditor.config.js"></script>
<script type="text/javascript" src="__STATIC__/js/ueditor/ueditor.all.min.js"></script>
<script type="text/javascript">
$(function () {
editorcontent = new baidu.editor.ui.Editor();
editorcontent.render('content');
try {
editorcontent.sync();
} catch (err) {
}
$('.btn-cancel-thumbnail').click(function () {
$('#thumbnail-preview').attr('src', '__TMPL__/public/assets/images/default-thumbnail.png');
$('#thumbnail').val('');
});
});
// function doSelectCategory() {
// var selectedCategoriesId = $('#js-categories-id-input').val();
// openIframeLayer("{:url('AdminCategory/select')}?ids=" + selectedCategoriesId, '请选择分类', {
// area: ['700px', '400px'],
// btn: ['确定', '取消'],
// yes: function (index, layero) {
// //do something
//
// var iframeWin = window[layero.find('iframe')[0]['name']];
// var selectedCategories = iframeWin.confirm();
// if (selectedCategories.selectedCategoriesId.length == 0) {
// layer.msg('请选择分类');
// return;
// }
// $('#js-categories-id-input').val(selectedCategories.selectedCategoriesId.join(','));
// $('#js-categories-name-input').val(selectedCategories.selectedCategoriesName.join(' '));
// //console.log(layer.getFrameIndex(index));
// layer.close(index); //如果设定了yes回调,需进行手工关闭
// }
// });
// }
</script>
</body>
</html>
... ...
<include file="public@header"/>
</head>
<body>
<div class="wrap js-check-wrap">
<ul class="nav nav-tabs">
<li class="active"><a href="javascript:;">保证金说明列表</a></li>
<li><a href="{:url('UserNeed/add')}">添加保证金说明</a></li>
</ul>
<form class="well form-inline margin-top-20" method="post" action="{:url('UserNeed/index')}">
<!--分类:-->
<!--<select class="form-control" name="category" style="width: 140px;">-->
<!--<option value='0'>全部</option>-->
<!--{$category_tree|default=''}-->
<!--</select> &nbsp;&nbsp;-->
时间:
<input type="text" class="form-control js-bootstrap-datetime" name="start_time"
value="{$start_time|default=''}"
style="width: 140px;" autocomplete="off">-
<input type="text" class="form-control js-bootstrap-datetime" name="end_time"
value="{$end_time|default=''}"
style="width: 140px;" autocomplete="off"> &nbsp; &nbsp;
关键字:
<input type="text" class="form-control" name="keyword" style="width: 200px;"
value="{$keyword|default=''}" placeholder="请输入说明标题">
<input type="submit" class="btn btn-primary" value="搜索"/>
<a class="btn btn-danger" href="{:url('UserNeed/index')}">清空</a>
</form>
<form class="js-ajax-form" action="" method="post">
<div class="table-actions">
<!--<notempty name="category">-->
<!--<button class="btn btn-primary btn-sm js-ajax-submit" type="submit"-->
<!--data-action="{:url('AdminArticle/listOrder')}">{:lang('SORT')}-->
<!--</button>-->
<!--</notempty>-->
<!--<button class="btn btn-primary btn-sm js-ajax-submit" type="submit"-->
<!--data-action="{:url('AdminArticle/publish',array('yes'=>1))}" data-subcheck="true">发布-->
<!--</button>-->
<!--<button class="btn btn-primary btn-sm js-ajax-submit" type="submit"-->
<!--data-action="{:url('AdminArticle/publish',array('no'=>1))}" data-subcheck="true">取消发布-->
<!--</button>-->
<!--<button class="btn btn-primary btn-sm js-ajax-submit" type="submit"-->
<!--data-action="{:url('AdminArticle/top',array('yes'=>1))}" data-subcheck="true">置顶-->
<!--</button>-->
<!--<button class="btn btn-primary btn-sm js-ajax-submit" type="submit"-->
<!--data-action="{:url('AdminArticle/top',array('no'=>1))}" data-subcheck="true">取消置顶-->
<!--</button>-->
<!--<button class="btn btn-primary btn-sm js-ajax-submit" type="submit"-->
<!--data-action="{:url('AdminArticle/recommend',array('yes'=>1))}" data-subcheck="true">推荐-->
<!--</button>-->
<!--<button class="btn btn-primary btn-sm js-ajax-submit" type="submit"-->
<!--data-action="{:url('AdminArticle/recommend',array('no'=>1))}" data-subcheck="true">取消推荐-->
<!--</button>-->
<!--
<notempty name="category">
<button class="btn btn-primary btn-sm js-articles-move" type="button">批量移动</button>
</notempty>
<button class="btn btn-primary btn-sm js-articles-copy" type="button">批量复制</button>
-->
<button class="btn btn-danger btn-sm js-ajax-submit" type="submit"
data-action="{:url('UserNeed/del')}" data-subcheck="true" data-msg="您确定删除吗?">
{:lang('DELETE')}
</button>
</div>
<table class="table table-hover table-bordered table-list">
<thead>
<tr>
<th width="15">
<label>
<input type="checkbox" class="js-check-all" data-direction="x" data-checklist="js-check-x">
</label>
</th>
<notempty name="category">
<th width="50">{:lang('SORT')}</th>
</notempty>
<th width="50">ID</th>
<th width="10%">标题</th>
<th>内容</th>
<th>排序</th>
<th width="130">更新时间</th>
<th width="130">发布时间</th>
<!--<th width="70">状态</th>-->
<th width="90">操作</th>
</tr>
</thead>
<foreach name="list" item="list">
<tr>
<td>
<input type="checkbox" class="js-check" data-yid="js-check-y" data-xid="js-check-x" name="ids[]"
value="{$list.id}" title="ID:{$list.id}">
</td>
<td>{$list.id}</td>
<td>
{$list.title}
</td>
<td>
{$list.content}
</td>
<td>
{$list.score}
</td>
<td>
{:date('Y-m-d H:i',$list['update_time'])}
</td>
<td>
{:date('Y-m-d H:i',$list['create_time'])}
<!--<empty name="vo.published_time">-->
<!--未发布-->
<!--<else/>-->
<!--{:date('Y-m-d H:i',$list['published_time'])}-->
<!--</empty>-->
</td>
<td>
<a href="{:url('UserNeed/add',array('id'=>$list['id']))}">{:lang('EDIT')}</a>
<a href="{:url('UserNeed/del',array('id'=>$list['id']))}" class="js-ajax-delete">{:lang('DELETE')}</a>
</td>
</tr>
</foreach>
</table>
<ul class="pagination">{$page|default=''}</ul>
</form>
</div>
<script src="__STATIC__/js/admin.js"></script>
<script>
function reloadPage(win) {
win.location.reload();
}
$(function () {
setCookie("refersh_time", 0);
Wind.use('ajaxForm', 'artDialog', 'iframeTools', function () {
//批量复制
$('.js-articles-copy').click(function (e) {
var ids = [];
$("input[name='ids[]']").each(function () {
if ($(this).is(':checked')) {
ids.push($(this).val());
}
});
if (ids.length == 0) {
art.dialog.through({
id: 'error',
icon: 'error',
content: '您没有勾选信息,无法进行操作!',
cancelVal: '关闭',
cancel: true
});
return false;
}
ids = ids.join(',');
art.dialog.open("__ROOT__/index.php?g=portal&m=AdminArticle&a=copy&ids=" + ids, {
title: "批量复制",
width: "300px"
});
});
//批量移动
$('.js-articles-move').click(function (e) {
var ids = [];
$("input[name='ids[]']").each(function () {
if ($(this).is(':checked')) {
ids.push($(this).val());
}
});
if (ids.length == 0) {
art.dialog.through({
id: 'error',
icon: 'error',
content: '您没有勾选信息,无法进行操作!',
cancelVal: '关闭',
cancel: true
});
return false;
}
ids = ids.join(',');
art.dialog.open("__ROOT__/index.php?g=portal&m=AdminArticle&a=move&old_term_id={$term.term_id|default=0}&ids=" + ids, {
title: "批量移动",
width: "300px"
});
});
});
});
</script>
</body>
</html>
\ No newline at end of file
... ...
<include file="public@header"/>
</head>
<body>
<div class="wrap js-check-wrap">
<ul class="nav nav-tabs">
<li class="active"><a href="javascript:;">保证金说明列表</a></li>
<li><a href="{:url('UserNeed/add')}">添加保证金说明</a></li>
</ul>
<form class="well form-inline margin-top-20" method="post" action="{:url('UserNeed/index')}">
<!--分类:-->
<!--<select class="form-control" name="category" style="width: 140px;">-->
<!--<option value='0'>全部</option>-->
<!--{$category_tree|default=''}-->
<!--</select> &nbsp;&nbsp;-->
时间:
<input type="text" class="form-control js-bootstrap-datetime" name="start_time"
value="{$start_time|default=''}"
style="width: 140px;" autocomplete="off">-
<input type="text" class="form-control js-bootstrap-datetime" name="end_time"
value="{$end_time|default=''}"
style="width: 140px;" autocomplete="off"> &nbsp; &nbsp;
关键字:
<input type="text" class="form-control" name="keyword" style="width: 200px;"
value="{$keyword|default=''}" placeholder="请输入说明标题">
<input type="submit" class="btn btn-primary" value="搜索"/>
<a class="btn btn-danger" href="{:url('UserNeed/index')}">清空</a>
</form>
<form class="js-ajax-form" action="" method="post">
<div class="table-actions">
<!--<notempty name="category">-->
<!--<button class="btn btn-primary btn-sm js-ajax-submit" type="submit"-->
<!--data-action="{:url('AdminArticle/listOrder')}">{:lang('SORT')}-->
<!--</button>-->
<!--</notempty>-->
<!--<button class="btn btn-primary btn-sm js-ajax-submit" type="submit"-->
<!--data-action="{:url('AdminArticle/publish',array('yes'=>1))}" data-subcheck="true">发布-->
<!--</button>-->
<!--<button class="btn btn-primary btn-sm js-ajax-submit" type="submit"-->
<!--data-action="{:url('AdminArticle/publish',array('no'=>1))}" data-subcheck="true">取消发布-->
<!--</button>-->
<!--<button class="btn btn-primary btn-sm js-ajax-submit" type="submit"-->
<!--data-action="{:url('AdminArticle/top',array('yes'=>1))}" data-subcheck="true">置顶-->
<!--</button>-->
<!--<button class="btn btn-primary btn-sm js-ajax-submit" type="submit"-->
<!--data-action="{:url('AdminArticle/top',array('no'=>1))}" data-subcheck="true">取消置顶-->
<!--</button>-->
<!--<button class="btn btn-primary btn-sm js-ajax-submit" type="submit"-->
<!--data-action="{:url('AdminArticle/recommend',array('yes'=>1))}" data-subcheck="true">推荐-->
<!--</button>-->
<!--<button class="btn btn-primary btn-sm js-ajax-submit" type="submit"-->
<!--data-action="{:url('AdminArticle/recommend',array('no'=>1))}" data-subcheck="true">取消推荐-->
<!--</button>-->
<!--
<notempty name="category">
<button class="btn btn-primary btn-sm js-articles-move" type="button">批量移动</button>
</notempty>
<button class="btn btn-primary btn-sm js-articles-copy" type="button">批量复制</button>
-->
<button class="btn btn-danger btn-sm js-ajax-submit" type="submit"
data-action="{:url('UserNeed/del')}" data-subcheck="true" data-msg="您确定删除吗?">
{:lang('DELETE')}
</button>
</div>
<table class="table table-hover table-bordered table-list">
<thead>
<tr>
<th width="15">
<label>
<input type="checkbox" class="js-check-all" data-direction="x" data-checklist="js-check-x">
</label>
</th>
<notempty name="category">
<th width="50">{:lang('SORT')}</th>
</notempty>
<th width="50">ID</th>
<th width="10%">标题</th>
<th>内容</th>
<th>排序</th>
<th width="130">更新时间</th>
<th width="130">发布时间</th>
<!--<th width="70">状态</th>-->
<th width="90">操作</th>
</tr>
</thead>
<foreach name="list" item="list">
<tr>
<td>
<input type="checkbox" class="js-check" data-yid="js-check-y" data-xid="js-check-x" name="ids[]"
value="{$list.id}" title="ID:{$list.id}">
</td>
<td>{$list.id}</td>
<td>
{$list.title}
</td>
<td>
{$list.content}
</td>
<td>
{$list.score}
</td>
<td>
{:date('Y-m-d H:i',$list['update_time'])}
</td>
<td>
{:date('Y-m-d H:i',$list['create_time'])}
<!--<empty name="vo.published_time">-->
<!--未发布-->
<!--<else/>-->
<!--{:date('Y-m-d H:i',$list['published_time'])}-->
<!--</empty>-->
</td>
<td>
<a href="{:url('UserNeed/add',array('id'=>$list['id']))}">{:lang('EDIT')}</a>
<a href="{:url('UserNeed/del',array('id'=>$list['id']))}" class="js-ajax-delete">{:lang('DELETE')}</a>
</td>
</tr>
</foreach>
</table>
<ul class="pagination">{$page|default=''}</ul>
</form>
</div>
<script src="__STATIC__/js/admin.js"></script>
<script>
function reloadPage(win) {
win.location.reload();
}
$(function () {
setCookie("refersh_time", 0);
Wind.use('ajaxForm', 'artDialog', 'iframeTools', function () {
//批量复制
$('.js-articles-copy').click(function (e) {
var ids = [];
$("input[name='ids[]']").each(function () {
if ($(this).is(':checked')) {
ids.push($(this).val());
}
});
if (ids.length == 0) {
art.dialog.through({
id: 'error',
icon: 'error',
content: '您没有勾选信息,无法进行操作!',
cancelVal: '关闭',
cancel: true
});
return false;
}
ids = ids.join(',');
art.dialog.open("__ROOT__/index.php?g=portal&m=AdminArticle&a=copy&ids=" + ids, {
title: "批量复制",
width: "300px"
});
});
//批量移动
$('.js-articles-move').click(function (e) {
var ids = [];
$("input[name='ids[]']").each(function () {
if ($(this).is(':checked')) {
ids.push($(this).val());
}
});
if (ids.length == 0) {
art.dialog.through({
id: 'error',
icon: 'error',
content: '您没有勾选信息,无法进行操作!',
cancelVal: '关闭',
cancel: true
});
return false;
}
ids = ids.join(',');
art.dialog.open("__ROOT__/index.php?g=portal&m=AdminArticle&a=move&old_term_id={$term.term_id|default=0}&ids=" + ids, {
title: "批量移动",
width: "300px"
});
});
});
});
</script>
</body>
</html>
\ No newline at end of file
... ...
<include file="public@header"/>
<link rel="stylesheet" href="__STATIC__/install/css/mdialog.css">
<style>
.popup{
width: 250px;
height: 100px;
background-color: rgba(0,0,0,0.5);
position: fixed;
top: 50%;
transform: translateY(-50px);
left: 0;
right: 0;
margin: 0 auto;
border-radius: 5px;
color: #ffffff;
}
.popup p{
text-align: center;
margin-top: 20px;
}
.popup span{
text-align: center;
line-height: 30px;
cursor: pointer;
}
.popup .queding{
display: inline-block;
width: 80px;
height: 30px;
background-color: #1E9FFF;
border-radius: 3px;
}
.popup span:hover{
opacity: 0.8;
}
.popup .quxiao{
display: inline-block;
width: 80px;
height: 30px;
ckground-color: #9cb945 ;
color: #333333;
border-radius: 3px;
background-color:#fff;
margin-left: 35px;
}
.btn_list{
margin: 0 auto;
width: 200px;
}
</style>
</head>
<body>
<div class="wrap">
<ul class="nav nav-tabs">
<li class="active"><a>{:lang('USER_OAUTHADMIN_INDEX')}</a></li>
</ul>
<form method="post" class="js-ajax-form margin-top-20">
<table class="table table-hover table-bordered">
<thead>
<tr>
<th>ID</th>
<th>姓名</th>
<th>手机号</th>
<th>城市</th>
<th>所属公司</th>
<th>门店</th>
<th>服务小区</th>
<th>推荐人</th>
<th>推荐人id</th>
<th>创建时间</th>
<th>更新时间</th>
<th>状态</th>
<th align="center">操作</th>
</tr>
</thead>
<tbody>
<foreach name="lists" item="vo">
<tr>
<td>{$vo.id}</td>
<td>{$vo.name}</td>
<td>{$vo.tel}</td>
<td>{$vo.city}</td>
<td>{$vo.company}</td>
<td>{$vo.store}</td>
<td>{$vo.quarters}</td>
<td>
<empty name="vo.referee_name">
暂无
</empty>
{$vo.referee_name}
</td>
<td>
<empty name="vo.referee_name">
暂无
</empty>
{$vo.referee_id}
</td>
<td>{:date('Y-m-d H:i:s',$vo['create_time'])}</td>
<td>{:date('Y-m-d H:i:s',$vo['update_time'])}</td>
<td>
<eq name="vo.status" value="1">
正常
</eq>
<eq name="vo.status" value="8">
已拉黑
</eq>
<eq name="vo.status" value="9">
已删除
</eq>
</td>
<td>
<eq name="vo.status" value="1">
<span class="black" style="color: #18BC9C; text-decoration:underline;" index="{$vo.id}">拉黑</span>
</eq>
<eq name="vo.status" value="8">
<span style="color:#aaaaaa;" index="{$vo.id}">已拉黑</span>
</eq>
<eq name="vo.status" value="9">
<span style="color:#aaaaaa;" index="{$vo.id}">已删除</span>
</eq>
</td>
</tr>
</foreach>
</tbody>
</table>
</form>
<div class="popup" style="display: none;">
<p>确认拉黑该用户</p>
<div class="btn_list">
<span class="queding">确认</span>
<span class="quxiao">取消</span>
</div>
</div>
</div>
<script src="__STATIC__/js/admin.js"></script>
<script src="__STATIC__/js/layer/layer.js"></script>
<script type="text/javascript" src="__STATIC__/js/zepto.min.js"></script>
<script type="text/javascript" src="__STATIC__/js/mdialog.js"></script>
<script type="">
$('.black').click(function () {
var id = $('.black').attr('index');
$('.popup').css('display','block');
// 删除
$('.queding').click(function () {
$.ajax({
type:"POST",
url:"{:url('AdminOauth/del')}",
data:{
"id":id,
},
success:function (data) {
new TipBox({type:'success',str:'操作成功',hasBtn:true});
$('.popup').css('display','none');
},
error:function () {
new TipBox({type:'error',str:'对不起,出错了!',hasBtn:true});
$('.popup').css('display','none');
}
})
})
})
$('.quxiao').click(function () {
$('.popup').css('display','none');
})
</script>
</body>
</html>
\ No newline at end of file
... ...