|
@@ -0,0 +1,84 @@
|
|
|
+<?php
|
|
|
+
|
|
|
+namespace app\data\controller\api\auth;
|
|
|
+
|
|
|
+use app\data\controller\api\Auth;
|
|
|
+use app\data\controller\api\Data;
|
|
|
+use app\data\model\DataCollectionLog;
|
|
|
+use app\data\model\DataPoolTalent;
|
|
|
+use app\data\model\DataRecruitment;
|
|
|
+use app\data\model\DataTeachingKnowledge;
|
|
|
+use app\data\model\DataUserApplyJobInfo;
|
|
|
+use app\data\model\DataUserApplyJobInfoChild;
|
|
|
+use app\data\model\ShopCoordination;
|
|
|
+use app\data\model\ShopOcean;
|
|
|
+use app\data\model\ShopProduction;
|
|
|
+use app\data\model\ShopPurchase;
|
|
|
+use app\data\service\MessageService;
|
|
|
+use think\admin\Storage;
|
|
|
+use think\db\Query;
|
|
|
+use think\exception\HttpResponseException;
|
|
|
+use think\admin\Controller;
|
|
|
+use hg\apidoc\annotation\Title;
|
|
|
+use hg\apidoc\annotation\Method;
|
|
|
+use hg\apidoc\annotation\Param;
|
|
|
+use hg\apidoc\annotation\Header;
|
|
|
+use hg\apidoc\annotation\Returned;
|
|
|
+use think\facade\Validate;
|
|
|
+use think\Request;
|
|
|
+
|
|
|
+/**
|
|
|
+ * @Title("采购订单")
|
|
|
+ */
|
|
|
+class Purchase extends Auth
|
|
|
+{
|
|
|
+ protected $noNeedLogin=[];
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @Title("列表")
|
|
|
+ * @Method("get")
|
|
|
+ * @Param ("page",desc="第几页")
|
|
|
+ * @Param ("limit",desc="每页几条")
|
|
|
+ * @Param ("tab",desc="1采购2生产3外协4海运")
|
|
|
+ * @Param ("sort",desc="1按距离排序2按价格排序")
|
|
|
+ * @Param ("sort_dir",desc="asc正序,desc倒序")
|
|
|
+ * @Param ("longitude",desc="当前用户的经度")
|
|
|
+ * @Param ("latitude",desc="当前用户的纬度")
|
|
|
+ */
|
|
|
+ public function list(Request $request,ShopPurchase $shopPurchase,ShopCoordination $shopCoordination,ShopOcean $shopOcean,ShopProduction $shopProduction)
|
|
|
+ {
|
|
|
+ $this->_vali([
|
|
|
+ 'longitude.require'=>'经度必须',
|
|
|
+ 'latitude.require'=>'纬度必须',
|
|
|
+ ],'get');
|
|
|
+ switch ($request['tab']){
|
|
|
+ case 1:
|
|
|
+ $query=$shopPurchase->newQuery();
|
|
|
+ break;
|
|
|
+ case 2:
|
|
|
+ $query=$shopProduction->newQuery();
|
|
|
+ break;
|
|
|
+ case 3:
|
|
|
+ $query=$shopCoordination->newQuery();
|
|
|
+ break;
|
|
|
+ case 4:
|
|
|
+ $query=$shopOcean->newQuery();
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ $this->error('类型必须');
|
|
|
+ }
|
|
|
+ if($request['sort']==1){
|
|
|
+ $query
|
|
|
+ ->field("*,round(st_distance_sphere(point(120.012484,30.298926),point(`longitude`,`latitude`))) as distance")
|
|
|
+ ->order('distance',$request['sort_dir']);
|
|
|
+ }elseif ($request['sort']==2){
|
|
|
+ $query->order('amount',$request['sort_dir']);
|
|
|
+ }
|
|
|
+ $query->with(['merchant']);
|
|
|
+ $list=$query
|
|
|
+ ->paginate($request['limit']?:15);
|
|
|
+ $this->success('',$list);
|
|
|
+ }
|
|
|
+
|
|
|
+}
|