diff --git a/app/admin/controller/ConfigController.php b/app/admin/controller/ConfigController.php index 2cc101baa..35d12c289 100644 --- a/app/admin/controller/ConfigController.php +++ b/app/admin/controller/ConfigController.php @@ -16,6 +16,7 @@ namespace app\admin\controller; use app\admin\logic\auth\AuthLogic; use app\admin\logic\ConfigLogic; +use think\facade\Db; /** * 配置控制器 @@ -54,6 +55,36 @@ class ConfigController extends BaseAdminController return $this->data($data); } - + /** + * @notes 获取省列表 + */ + public function province(){ + $list= Db::name('geo_province')->select()->toArray(); + return $this->success('ok',$list); + } + /** + * @notes 获取市列表 + */ + public function city(){ + $province_code=$this->request->get('code'); + $list= Db::name('geo_city')->where('province_code',$province_code)->select()?->toArray(); + return $this->success('ok',$list); + } + /** + * @notes 获取区列表 + */ + public function area(){ + $city_code=$this->request->get('code'); + $list= Db::name('geo_area')->where('city_code',$city_code)->select()?->toArray(); + return $this->success('ok',$list); + } + /** + * @notes 获取街道列表 + */ + public function street(){ + $area_code=$this->request->get('code'); + $list= Db::name('geo_street')->where('area_code',$area_code)->select()?->toArray(); + return $this->success('ok',$list); + } } \ No newline at end of file diff --git a/app/admin/logic/system_store/SystemStoreLogic.php b/app/admin/logic/system_store/SystemStoreLogic.php index 42a601854..464b334b4 100644 --- a/app/admin/logic/system_store/SystemStoreLogic.php +++ b/app/admin/logic/system_store/SystemStoreLogic.php @@ -5,8 +5,9 @@ namespace app\admin\logic\system_store; use app\common\model\system_store\SystemStore; use app\common\logic\BaseLogic; +use app\common\model\system_store\SystemStoreStaff; use think\facade\Db; - +use Webman\Config; /** * 门店列表逻辑 @@ -28,15 +29,36 @@ class SystemStoreLogic extends BaseLogic { Db::startTrans(); try { - SystemStore::create([ + $passwordSalt = Config::get('project.unique_identification'); + $password=create_password($params['password'], $passwordSalt); + $store=SystemStore::create([ 'name' => $params['name'], 'introduction' => $params['introduction'], 'phone' => $params['phone'], 'detailed_address' => $params['detailed_address'], 'image' => $params['image'], - 'is_show' => $params['is_show'] + 'is_show' => $params['is_show'], + 'longitude' => $params['longitude'], + 'latitude' => $params['latitude'], + 'day_start' => $params['day_start'], + 'day_end' => $params['day_end'], + 'province' => $params['province_code'], + 'city' => $params['city_code'], + 'area' => $params['area_code'], + 'street' => $params['street_code'], ]); + $taff=[ + 'store_id'=>$store['id'], + 'account'=>$params['phone'], + 'pwd'=>$password, + 'avatar'=>$params['image'], + 'staff_name'=>$params['name'], + 'phone'=>$params['phone'], + 'is_admin'=>1, + 'status'=>1, + ]; + SystemStoreStaff::create($taff); Db::commit(); return true; } catch (\Exception $e) { diff --git a/app/api/controller/IndexController.php b/app/api/controller/IndexController.php index 8b50d624f..7c4b94db7 100644 --- a/app/api/controller/IndexController.php +++ b/app/api/controller/IndexController.php @@ -2,33 +2,14 @@ namespace app\api\controller; -use app\admin\lists\express\ExpressLists; -use app\admin\logic\operation\OpurchaseclassLogic; use app\admin\validate\tools\GenerateTableValidate; use app\admin\logic\tools\GeneratorLogic; -use app\common\model\goods\Goods; -use app\common\model\goods\Goodsclass; -use app\common\model\retail\Cashierclass; -use app\common\service\pay\PayService; -use app\common\service\PushService; -use app\common\service\wechat\WeChatMnpService; -use app\common\service\wechat\WeChatOaService; -use DateTime; -use Firebase\JWT\JWT; -use Firebase\JWT\Key; -use stdClass; use think\facade\Db; -use Webman\Config; -use Webman\RedisQueue\Redis; -use Yansongda\Pay\Pay; -use Webman\Push\Api; -use JPush\Client as JPush; -use support\Log; -use support\Redis as SupportRedis; + class IndexController extends BaseApiController { - public $notNeedLogin = ['index','app_update','express_list']; + public $notNeedLogin = ['index','app_update','express_list','province','city','area','street']; public function index() { @@ -57,4 +38,37 @@ class IndexController extends BaseApiController return $this->success('ok',$find); } + + /** + * @notes 获取省列表 + */ + public function province(){ + $list= Db::name('geo_province')->select()->toArray(); + return $this->success('ok',$list); + } + /** + * @notes 获取市列表 + */ + public function city(){ + $province_code=$this->request->get('code'); + $list= Db::name('geo_city')->where('province_code',$province_code)->select()?->toArray(); + return $this->success('ok',$list); + } + /** + * @notes 获取区列表 + */ + public function area(){ + $city_code=$this->request->get('code'); + $list= Db::name('geo_area')->where('city_code',$city_code)->select()?->toArray(); + return $this->success('ok',$list); + } + /** + * @notes 获取街道列表 + */ + public function street(){ + $area_code=$this->request->get('area_code'); + $list= Db::name('geo_street')->where('area_code',$area_code)->select()?->toArray(); + return $this->success('ok',$list); + } + }