function smarty_function_load_data($params, &$smarty)
{
    (!isset($params['table']) || empty($params['table'])) && exit('`table` is empty!');
    // $Mconfig = include(hopedir."config/hopeconfig.php");
    // print_r($Mconfig);
    $type = isset($params['type']) ? $params['type'] : 'list';
    //total  总数量   one    list 3个分类
    $fileds = isset($params['fileds']) ? $params['fileds'] : '*';
    $where = isset($params['where']) ? $params['where'] : '';
    $where = empty($where) ? '' : ' where ' . $where;
    $orderby = isset($params['orderby']) ? 'order by ' . $params['orderby'] : '';
    $limit = isset($params['limit']) ? 'LIMIT 0,' . $params['limit'] : 'LIMIT 0,1';
    if (!class_exists('mysql_class')) {
        include hopedir . "lib/core/extend/mysql_class.php";
        //core\extend
        $mysql = new mysql_class();
    } else {
        $mysql = new mysql_class();
    }
    $page = intval(IFilter::act(IReq::get('page')));
    $pagesize = intval(IFilter::act(IReq::get('pagesize')));
    $pagesize = isset($params['pagesize']) ? $params['pagesize'] : $pagesize;
    $pagesize = empty($pagesize) ? 10 : $pagesize;
    // $db = $class::factory(array('table' => $params['table']));
    //var_dump($params);
    if (!empty($params['assign'])) {
        //把数据赋值给变量$params['assign'],这样前端就可以使用这个变量了(例如可以结合foreach输出一个列表等)
        //  $smarty->assign($params['assign'], $db->get_block_list(array($params['where']), $params['limit']));
        if ($type == 'total') {
            $result = $mysql->counts("select " . $fileds . " from " . Mysite::$app->config['tablepre'] . $params['table'] . "  " . $where . " " . $orderby . " " . $limit . "");
        } elseif ($type == 'one') {
            $result = $mysql->select_one("select " . $fileds . " from " . Mysite::$app->config['tablepre'] . $params['table'] . "  " . $where . " " . $orderby . " " . $limit . "");
        } else {
            if (isset($params['showpage']) && $params['showpage'] == true) {
                if (!class_exists('page')) {
                    include hopedir . "lib/core/extend/page.php";
                    //core\extend
                    $pageclass = new page();
                } else {
                    $pageclass = new page();
                }
                $pageclass->setpage($page, $pagesize);
                $result['list'] = $mysql->getarr("select " . $fileds . " from " . Mysite::$app->config['tablepre'] . $params['table'] . "  " . $where . "  " . $orderby . "  limit " . $pageclass->startnum() . ", " . $pageclass->getsize() . "");
                $shuliang = $mysql->counts("select " . $fileds . " from " . Mysite::$app->config['tablepre'] . $params['table'] . "  " . $where . " ");
                $pageclass->setnum($shuliang);
                if (isset($params['pagetype'])) {
                    $result['pagecontent'] = $pageclass->ajaxbar($params['pagetype']);
                } else {
                    $result['pagecontent'] = $pageclass->getpagebar();
                }
            } else {
                $result['list'] = $mysql->getarr("select " . $fileds . " from " . Mysite::$app->config['tablepre'] . $params['table'] . "  " . $where . " " . $orderby . "  " . $limit . "");
            }
        }
        /*
            $result['list'] = array();
             $result['pagecontent'] = ''; */
        $smarty->assign($params['assign'], $result);
    }
}
Example #2
0
 public function singlelist()
 {
     $this->checkshoplogin();
     $shopid = ICookie::get('adminshopid');
     if ($shopid <= 0) {
         $this->message('获取失败');
     }
     $pageinfo = new page();
     $pageinfo->setpage(IReq::get('page'));
     $data['list'] = $this->mysql->getarr("SELECT * FROM " . Mysite::$app->config['tablepre'] . "shop_single WHERE shop_id={$shopid} ORDER BY single_id DESC LIMIT " . $pageinfo->startnum() . ", " . $pageinfo->getsize() . " ");
     $shuliang = $this->mysql->counts("SELECT * FROM " . Mysite::$app->config['tablepre'] . "shop_single WHERE shop_id={$shopid}");
     $pageinfo->setnum($shuliang);
     $data['pagecontent'] = $pageinfo->getpagebar();
     Mysite::$app->setdata($data);
 }
Example #3
0
 function drawbacklog()
 {
     $pageinfo = new page();
     $pageinfo->setpage(IReq::get('page'));
     $data['list'] = $this->mysql->getarr("select * from " . Mysite::$app->config['tablepre'] . "drawbacklog  order by  id desc  limit " . $pageinfo->startnum() . ", " . $pageinfo->getsize() . " ");
     $shuliang = $this->mysql->counts("select * from " . Mysite::$app->config['tablepre'] . "drawbacklog  order by  id desc");
     $pageinfo->setnum($shuliang);
     $data['pagecontent'] = $pageinfo->getpagebar();
     Mysite::$app->setdata($data);
 }
Example #4
0
 function collect()
 {
     $this->checkmemberlogin();
     $pageinfo = new page();
     $data['shoptypelist'] = $this->mysql->getarr("select * from " . Mysite::$app->config['tablepre'] . "shoptype order by orderid asc ");
     $pageinfo->setpage(intval(IReq::get('page')), 100);
     $data['list'] = $this->mysql->getarr("select co.collectid,co.orderid,sh.* from " . Mysite::$app->config['tablepre'] . "collect as co left join   " . Mysite::$app->config['tablepre'] . "shop as sh on sh.id = co.collectid  where co.uid = '" . $this->member['uid'] . "' and co.collecttype=0 order by co.orderid asc limit " . $pageinfo->startnum() . ", " . $pageinfo->getsize() . "");
     $shuliang = $this->mysql->counts("select * from " . Mysite::$app->config['tablepre'] . "collect where uid = '" . $this->member['uid'] . "' and collecttype=0");
     $pageinfo->setnum($shuliang);
     $data['pagecontent'] = $pageinfo->getpagebar();
     Mysite::$app->setdata($data);
 }
Example #5
0
 function wxuser()
 {
     $pageinfo = new page();
     $pageinfo->setpage(IReq::get('page'));
     $data['list'] = $this->mysql->getarr("select a.openid,a.is_bang,b.*  from " . Mysite::$app->config['tablepre'] . "wxuser  as a left join " . Mysite::$app->config['tablepre'] . "member as b on b.uid = a.uid   order by a.uid desc  limit " . $pageinfo->startnum() . ", " . $pageinfo->getsize() . " ");
     $shuliang = $this->mysql->counts("select * from " . Mysite::$app->config['tablepre'] . "wxuser  ");
     $pageinfo->setnum($shuliang);
     $data['pagecontent'] = $pageinfo->getpagebar();
     Mysite::$app->setdata($data);
     /*
     		$wx_s = new wx_s();
     
     	  print_r($wx_s->get_img());
     
     		if($wx_s->menu()){
     		print_r($wx_s->returnmenu());
     	}else{
     		$this->json($wx_s->err());
     	} */
     /*
     		if($wx_s->get_user()){
     			print_r($wx_s->userlist());
     		}else{
     			echo $wx_s->err();
     		} */
     /*
     		if($wx_s->sendmsg('订单编号为:dno371033343,总价48元,详情:番茄炒蛋7元','oKDxjuLiZlRRIaI_RVdex2NOJx_E')){
     		    echo 'ok';
     		}else{
     		   echo $wx_s->err();
     		}*/
     /*
     		if($wx_s->sendmsg('测试发送客服消息3','oKDxjuL-79rRF_ZQaElogLFlaTho')){
     		    echo 'ok';
     		}else{
     		   echo $wx_s->err();
     		}*/
     /*设置 发送客服消息   oKDxjuLiZlRRIaI_RVdex2NOJx_E     */
 }
Example #6
0
 public function wxuser()
 {
     $this->checkshoplogin();
     $shopid = ICookie::get('adminshopid');
     if ($shopid <= 0) {
         $this->message('获取失败');
     }
     $pageinfo = new page();
     $pageinfo->setpage(IReq::get('page'));
     $data['list'] = $this->mysql->getarr("select a.openid,a.is_bang,a.is_merchant,b.*  from " . Mysite::$app->config['tablepre'] . "shop_wxuser  as a left join " . Mysite::$app->config['tablepre'] . "member as b on b.uid = a.uid where shopid={$shopid}  order by a.uid desc  limit " . $pageinfo->startnum() . ", " . $pageinfo->getsize() . " ");
     $shuliang = $this->mysql->counts("select * from " . Mysite::$app->config['tablepre'] . "shop_wxuser where shopid={$shopid}");
     $pageinfo->setnum($shuliang);
     $data['pagecontent'] = $pageinfo->getpagebar();
     Mysite::$app->setdata($data);
 }
Example #7
0
 function userorder()
 {
     $link = IUrl::creatUrl('wxsite/index');
     if ($this->member['uid'] == 0) {
         $this->message('', $link);
     }
     $pageinfo = new page();
     $pageinfo->setpage(intval(IReq::get('page')), 20);
     //
     $datalist = $this->mysql->getarr("select id,shopname,allcost,addtime,status,is_ping,shoptype,is_goshop from " . Mysite::$app->config['tablepre'] . "order where buyeruid='" . $this->member['uid'] . "' order by id desc limit " . $pageinfo->startnum() . ", " . $pageinfo->getsize() . "");
     $temparray = array('0' => '外卖', '1' => '超市', '2' => '其他');
     $backdata = array();
     foreach ($datalist as $key => $value) {
         $listdet = $this->mysql->getarr("select * from " . Mysite::$app->config['tablepre'] . "orderdet where order_id='" . $value['id'] . "'");
         $value['det'] = '';
         foreach ($listdet as $k => $v) {
             $value['det'] .= $v['goodsname'] . ',';
         }
         $value['shoptype'] = $temparray[$value['shoptype']];
         $value['addtime'] = date('m-d H:i', $value['addtime']);
         $backdata[] = $value;
     }
     $this->success($backdata);
 }
Example #8
0
 function overpiont()
 {
     //id	orderid	orderdetid	shopid	goodsid	uid	content	addtime	replycontent	replytime	point 评分	is_show
     $this->checkmemberlogin();
     $this->setstatus();
     $pageinfo = new page();
     $pageinfo->setpage(intval(IReq::get('page')));
     $showtime = time() - 7 * 24 * 60 * 60;
     if (empty($this->member['uid'])) {
         $this->message('未登陆');
     }
     $where = ' and   status = 3 and is_ping = 1 and posttime >' . $showtime;
     $data['list'] = $this->mysql->getarr("select * from " . Mysite::$app->config['tablepre'] . "order where buyeruid='" . $this->member['uid'] . "'  " . $where . " order by id desc limit " . $pageinfo->startnum() . ", " . $pageinfo->getsize() . "");
     $shuliang = $this->mysql->counts("select * from " . Mysite::$app->config['tablepre'] . "order where buyeruid='" . $this->member['uid'] . "' " . $where . " ");
     $pageinfo->setnum($shuliang);
     $data['pagecontent'] = $pageinfo->getpagebar();
     $data['pageall'] = $pageinfo->totalpage();
     $data['pagenow'] = intval(IReq::get('page')) == 0 ? 1 : intval(IReq::get('page'));
     $data['allcount'] = $shuliang;
     Mysite::$app->setdata($data);
 }