|
|
@@ -2,6 +2,7 @@
|
|
|
namespace app\api\logic;
|
|
|
|
|
|
use app\common\logic\BaseLogic;
|
|
|
+use app\common\model\external\ExternalPlatform;
|
|
|
use app\common\model\external\ExternalPlatformGoods;
|
|
|
use app\common\model\goods\Goods;
|
|
|
use app\common\model\goods_category\GoodsCategory;
|
|
|
@@ -25,8 +26,11 @@ class GoodsLogic extends BaseLogic
|
|
|
* @author whitef
|
|
|
* @date 2022/9/20 17:09
|
|
|
*/
|
|
|
- public static function detail($id,$type,$userId = 0,$service_work_id = 0){
|
|
|
+ public static function detail($id,$type,$userId = 0,$params = []){
|
|
|
$where = [];
|
|
|
+ $service_work_id = $params['service_work_id']??0;
|
|
|
+ $platform_appid = $params['platform_appid']??0;
|
|
|
+ $platform_value = 0;
|
|
|
if($type == 'category'){
|
|
|
$where[] = ['goods_category_id','=',$id];
|
|
|
$where[] = ['user_id','=',0];
|
|
|
@@ -35,6 +39,9 @@ class GoodsLogic extends BaseLogic
|
|
|
if($service_work_id > 0){
|
|
|
$platform_value = ServiceWork::where('id',$service_work_id)->value('external_platform_id');
|
|
|
$where[] = ['platform_value','=',$platform_value];
|
|
|
+ }elseif ($platform_appid > 0){
|
|
|
+ $platform_value = ExternalPlatform::where('appid',$platform_appid)->value('id');
|
|
|
+ $where[] = ['platform_value','=',$platform_value];
|
|
|
}else{
|
|
|
$where[] = ['platform_value','=',0];
|
|
|
}
|
|
|
@@ -53,7 +60,7 @@ class GoodsLogic extends BaseLogic
|
|
|
if(!empty($goods)){
|
|
|
$data = [];
|
|
|
foreach ($goods as $key => $value) {
|
|
|
- if($service_work_id > 0){
|
|
|
+ if($service_work_id > 0 || $platform_appid > 0){
|
|
|
$value['service_fee'] = self::getPlatformServiceFee($platform_value,$value['id'])?:$value['service_fee'];
|
|
|
}
|
|
|
if($value['goods_payment_type'] == '2'){
|