Jddj.php 2.77 KB
<?php
/**
 * tpshop
 * ============================================================================
 * 版权所有 2015-2027 深圳搜豹网络科技有限公司,并保留所有权利。
 * 网站地址: http://www.tp-shop.cn
 * ----------------------------------------------------------------------------
 * 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和使用 .
 * 不允许对程序代码以任何形式任何目的的再发布。
 * ============================================================================
 * Author: 当燃
 * Date: 2015-09-09
 */

namespace app\manager\controller;

use think\db\Query;
use think\Page;
use think\AjaxPage;
use think\Verify;
use think\Db;
use think\Session;
use think\Cache;

use qcloudcos\Conf;
use qcloudcos\Myqcloudcos;

class Jddj extends Base
{

    public $group;
    /*
    * 初始化操作
    */
    public function __construct()
    {
        parent::__construct();
        $this->group = include APP_PATH.'admin/conf/menuarr.php';
    }

    /********************************************商家模块**************************************************************/
    /**
     * 获取商家列表
     * @return store_list
     */
    public function index()
    {
        $model = M('jd_store');
        $list = array();
        $pagenum=20;//每页显示多少条
        if ((int)I('pagenum/s')>0)
        {
            $pagenum=I('pagenum/s');
        }

        $keywords = I('keywords/s');
        $is_audit =  I('shenghe/s');
        $is_ylpapp =  I('is_ylpapp/s');
        $qy=I('qianyi/s');
        $is_usererp =  I('is_usererp/s');
        if ($is_usererp !=""){
            if($is_usererp==1) {
                $where['b.ERPId']=array('neq','');
            }
            else
            {
                $where['b.ERPId']='';
            }
        }
        if ($keywords) {
            $where['a.venderid|b.ERPId|b.store_name']=array(['like','%'.$keywords.'%']);;
        }

        $count = $model->alias('a')
            ->join('store b','a.store_id=b.store_id','left')
            ->where($where)->count(1);
        $Page = $pager = new Page($count,$pagenum);
        $list = $model->alias('a')
            ->join('store b','a.store_id=b.store_id','left')
            ->where($where)
            ->limit($Page->firstRow.','.$Page->listRows)->order('id asc')
            ->field('a.*,b.store_name,b.ERPId')
            ->select();
        $show = $Page->show();
        $this->assign('keywords',$keywords);
        $this->assign('list',$list);// 赋值数据集
        $this->assign('page',$show);// 赋值分页输出
        $this->assign('pager',$pager);
        $this->assign('pagenum',$pagenum);
        $this->assign('oldurl',urlencode(curPageURL()));
        return $this->fetch();
    }





}