You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

42 lines
957 B

<?php
namespace app\appapi\controller\v1;
use app\appapi\ApiController;
use think\facade\Cookie;
use think\facade\Db;
class Shop extends ApiController
{
public function getShopInfo(){
$result = [
'session_id' => $this->SessionId,
'shop_config' => load_config()
];
return $this->Success($result);
}
public function getArea(){
$area = $this->genArea();
return $this->Success($area);
}
private function genArea($pid=0){
$tarea = Db::name('region')
->where('parent_id',$pid)
->select()
->toArray();
$area = [];
foreach($tarea as $key => $val){
$area[$key]['text'] = $val['region_name'];
$area[$key]['value'] = $val['region_name'];
$area[$key]['zipcode'] = $val['zipcode'];
$area[$key]['children'] = $this->genArea($val['region_id']);
}
return $area;
}
}