index.html
<a href="javascript:;" class="btn btn-info btn-check-back hidden" title="{:__('check-back')}" ><i class="fa fa-trash" ></i> {:__('Verify Chargeback')}</a>
corresponds to js
$(".btn-check-back").on('click',function() {
var that = this;
var ids = Table.api.selectedids(table);
Layer.prompt({title: __('Please enter the time (unit: minutes)'), formType: 0}, function (value, index){
Backend.api.ajax({
url: "dy/task_order/multi?action=mback&m=" + value + "&ids=" + ids,
data: $(that).closest("form").serialize()
},function() {
$(".btn-refresh").trigger("click");
Layer.close(index);
});
});
});
Corresponding logic processing
public function multi($ids = "")
{
...
if($this->request->param('action') == 'back') {
$ids = explode(',',$ids);
$success = 0;
$error = 0;
$count = count($ids);
foreach($ids as $id) {
$order = \app\admin\model\Dy\TaskOrder::find($id);
if (!$order || $order->status != TaskOrderStatus::ING || !$order->vid) {
$error++;
continue;
}
if($order->channel == OrderChannelEnum::PLATFORM) {
$ret = \app\admin\model\Dy\TaskOrder::backOrderForIn($order->id,'Background manual refund',BackLogType::ADMIN_ACTION,'Background manual refund');
$ret === true and $success = $success + 1 or $error = $error + 1;
} else {
$ret = \app\admin\model\Dy\TaskOrder::backOrderForOut($order->order_id,BackLogType::ADMIN_ACTION,'Background manual refund');
$ret === true and $success = $success + 1 or $error = $error + 1;
}
}
$this->success("Processing: {$count}, successful chargeback: {$success}, unsuccessful chargeback: {$error}");
}
...
}
Post comment 取消回复