application/index/controller/UserFreight.php
(开头部分) 4KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
<?php
namespace app\index\controller;
//use think\Controller;
use app\index\model\GoodsSpace;
use app\index\model\FreightCaseSpace;
use app\index\model\FreightDetailSpace;
use app\index\model\RegionSpace;
class UserFreight extends UserBase {
public function index() {
$GoodsSpace = GoodsSpace::where('pub_uid', session('uid', '', 'index'))->order('update_time', 'asc')->select();
$FreightCaseSpace = FreightCaseSpace::where('uid', session('uid', '', 'index'))->order('id', 'asc')->select();
$case_num=count($FreightCaseSpace) ;
$RegionSpace =db(region_space)->where('ParentId', 1)->order('PkId', 'asc')->select();
$this->assign('case_num', $case_num);
$this->assign('FreightCaseSpace', $FreightCaseSpace);
$this->assign('RegionSpace', $RegionSpace);
$this->assign('GoodsSpace', $GoodsSpace);
return $this->fetch();
}
//删除商品 动作
public function del_case_action() {
//检查当前删除购物商品的人是否是之前商品购买者 防止外部代码删除
if(session('uid','', 'index')==request()->param('value')){
//传过来的id删case
$res=FreightCaseSpace::where('id', request()->param('id'))->delete();
//传过来的case_id删Detail里的相关
$res=FreightDetailSpace::where(['case_id' => request()->param('name'),'uid' => request()->param('value')])->delete();
return $this->json_data($res);
}
}
public function freight_detail() {
$FreightDetailSpace = FreightDetailSpace::where('case_id',request()->param('case_id'))->select();
foreach ($FreightDetailSpace as $value) {
$arr_province_name=$this->get_province_by_idstr($value['province']);
$str_province_name=implode(",", $arr_province_name);
$value["province_name"]=$str_province_name;
$new_FreightDetailSpace[]=$value;
// dump($result);
}
$this->assign('FreightDetailSpace', $new_FreightDetailSpace);
$this->assign('case_name',request()->param('case_name'));
return $this->fetch();
}
public function get_province_by_idstr($str) {
$RegionSpace =db(region_space)->where('ParentId', 1)->order('PkId', 'asc')->select();
//整理省数组为关联数组 RegionName=〉PkId
foreach ($RegionSpace as $v) {
$region[$v['RegionName']]=$v['PkId'];
后面还有 43 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。